diff --git a/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/create/SyncCreateSetCredentialsProvider.java b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..e61cf285763 --- /dev/null +++ b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.mediatranslation.v1beta1.samples; + +// [START +// mediatranslation_v1beta1_generated_speechtranslationserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceClient; +import com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceSettings; +import com.google.cloud.mediatranslation.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SpeechTranslationServiceSettings speechTranslationServiceSettings = + SpeechTranslationServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + SpeechTranslationServiceClient speechTranslationServiceClient = + SpeechTranslationServiceClient.create(speechTranslationServiceSettings); + } +} +// [END +// mediatranslation_v1beta1_generated_speechtranslationserviceclient_create_setcredentialsprovider_sync] diff --git a/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/create/SyncCreateSetCredentialsProvider1.java b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..062fbaaa914 --- /dev/null +++ b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.mediatranslation.v1beta1.samples; + +// [START +// mediatranslation_v1beta1_generated_speechtranslationserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceClient; +import com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SpeechTranslationServiceSettings speechTranslationServiceSettings = + SpeechTranslationServiceSettings.newBuilder() + .setTransportChannelProvider( + SpeechTranslationServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + SpeechTranslationServiceClient speechTranslationServiceClient = + SpeechTranslationServiceClient.create(speechTranslationServiceSettings); + } +} +// [END +// mediatranslation_v1beta1_generated_speechtranslationserviceclient_create_setcredentialsprovider1_sync] diff --git a/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/create/SyncCreateSetEndpoint.java b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..ac22aa1e4ab --- /dev/null +++ b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.mediatranslation.v1beta1.samples; + +// [START mediatranslation_v1beta1_generated_speechtranslationserviceclient_create_setendpoint_sync] +import com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceClient; +import com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceSettings; +import com.google.cloud.mediatranslation.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SpeechTranslationServiceSettings speechTranslationServiceSettings = + SpeechTranslationServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + SpeechTranslationServiceClient speechTranslationServiceClient = + SpeechTranslationServiceClient.create(speechTranslationServiceSettings); + } +} +// [END mediatranslation_v1beta1_generated_speechtranslationserviceclient_create_setendpoint_sync] diff --git a/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/streamingtranslatespeech/AsyncStreamingTranslateSpeech.java b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/streamingtranslatespeech/AsyncStreamingTranslateSpeech.java new file mode 100644 index 00000000000..da6e7618127 --- /dev/null +++ b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationserviceclient/streamingtranslatespeech/AsyncStreamingTranslateSpeech.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.mediatranslation.v1beta1.samples; + +// [START +// mediatranslation_v1beta1_generated_speechtranslationserviceclient_streamingtranslatespeech_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceClient; +import com.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechRequest; +import com.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse; + +public class AsyncStreamingTranslateSpeech { + + public static void main(String[] args) throws Exception { + asyncStreamingTranslateSpeech(); + } + + public static void asyncStreamingTranslateSpeech() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SpeechTranslationServiceClient speechTranslationServiceClient = + SpeechTranslationServiceClient.create()) { + BidiStream bidiStream = + speechTranslationServiceClient.streamingTranslateSpeechCallable().call(); + StreamingTranslateSpeechRequest request = + StreamingTranslateSpeechRequest.newBuilder().build(); + bidiStream.send(request); + for (StreamingTranslateSpeechResponse response : bidiStream) { + // Do something when a response is received. + } + } + } +} +// [END +// mediatranslation_v1beta1_generated_speechtranslationserviceclient_streamingtranslatespeech_async] diff --git a/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationservicesettings/streamingtranslatespeech/SyncStreamingTranslateSpeech.java b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationservicesettings/streamingtranslatespeech/SyncStreamingTranslateSpeech.java new file mode 100644 index 00000000000..5bcffe358b9 --- /dev/null +++ b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/speechtranslationservicesettings/streamingtranslatespeech/SyncStreamingTranslateSpeech.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.mediatranslation.v1beta1.samples; + +// [START +// mediatranslation_v1beta1_generated_speechtranslationservicesettings_streamingtranslatespeech_sync] +import com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceSettings; +import java.time.Duration; + +public class SyncStreamingTranslateSpeech { + + public static void main(String[] args) throws Exception { + syncStreamingTranslateSpeech(); + } + + public static void syncStreamingTranslateSpeech() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SpeechTranslationServiceSettings.Builder speechTranslationServiceSettingsBuilder = + SpeechTranslationServiceSettings.newBuilder(); + speechTranslationServiceSettingsBuilder + .streamingTranslateSpeechSettings() + .setRetrySettings( + speechTranslationServiceSettingsBuilder + .streamingTranslateSpeechSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SpeechTranslationServiceSettings speechTranslationServiceSettings = + speechTranslationServiceSettingsBuilder.build(); + } +} +// [END +// mediatranslation_v1beta1_generated_speechtranslationservicesettings_streamingtranslatespeech_sync] diff --git a/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/stub/speechtranslationservicestubsettings/streamingtranslatespeech/SyncStreamingTranslateSpeech.java b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/stub/speechtranslationservicestubsettings/streamingtranslatespeech/SyncStreamingTranslateSpeech.java new file mode 100644 index 00000000000..158675ee137 --- /dev/null +++ b/mediatranslation/generated/com/google/cloud/mediatranslation/v1beta1/stub/speechtranslationservicestubsettings/streamingtranslatespeech/SyncStreamingTranslateSpeech.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.mediatranslation.v1beta1.stub.samples; + +// [START +// mediatranslation_v1beta1_generated_speechtranslationservicestubsettings_streamingtranslatespeech_sync] +import com.google.cloud.mediatranslation.v1beta1.stub.SpeechTranslationServiceStubSettings; +import java.time.Duration; + +public class SyncStreamingTranslateSpeech { + + public static void main(String[] args) throws Exception { + syncStreamingTranslateSpeech(); + } + + public static void syncStreamingTranslateSpeech() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SpeechTranslationServiceStubSettings.Builder speechTranslationServiceSettingsBuilder = + SpeechTranslationServiceStubSettings.newBuilder(); + speechTranslationServiceSettingsBuilder + .streamingTranslateSpeechSettings() + .setRetrySettings( + speechTranslationServiceSettingsBuilder + .streamingTranslateSpeechSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SpeechTranslationServiceStubSettings speechTranslationServiceSettings = + speechTranslationServiceSettingsBuilder.build(); + } +} +// [END +// mediatranslation_v1beta1_generated_speechtranslationservicestubsettings_streamingtranslatespeech_sync]