Skip to content

Commit

Permalink
feat: Enable REST transport for most of Java and Go clients (#681)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 456641589

Source-Link: googleapis/googleapis@8a251f5

Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Jun 23, 2022
1 parent 09cd503 commit ceecd91
Show file tree
Hide file tree
Showing 156 changed files with 7,050 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_lookupserviceclient_create_setcredentialsprovider_sync]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
import com.google.cloud.servicedirectory.v1.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.
LookupServiceSettings lookupServiceSettings =
LookupServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
}
}
// [END servicedirectory_v1_generated_lookupserviceclient_create_setcredentialsprovider_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_lookupserviceclient_create_setcredentialsprovider1_sync]
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;

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.
LookupServiceSettings lookupServiceSettings =
LookupServiceSettings.newBuilder()
.setTransportChannelProvider(
LookupServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
}
}
// [END servicedirectory_v1_generated_lookupserviceclient_create_setcredentialsprovider1_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_lookupserviceclient_create_setendpoint_sync]
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
import com.google.cloud.servicedirectory.v1.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.
LookupServiceSettings lookupServiceSettings =
LookupServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
}
}
// [END servicedirectory_v1_generated_lookupserviceclient_create_setendpoint_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_lookupserviceclient_resolveservice_async]
import com.google.api.core.ApiFuture;
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.ResolveServiceRequest;
import com.google.cloud.servicedirectory.v1.ResolveServiceResponse;
import com.google.cloud.servicedirectory.v1.ServiceName;

public class AsyncResolveService {

public static void main(String[] args) throws Exception {
asyncResolveService();
}

public static void asyncResolveService() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) {
ResolveServiceRequest request =
ResolveServiceRequest.newBuilder()
.setName(
ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString())
.setMaxEndpoints(2074789987)
.setEndpointFilter("endpointFilter-1834249875")
.build();
ApiFuture<ResolveServiceResponse> future =
lookupServiceClient.resolveServiceCallable().futureCall(request);
// Do something.
ResolveServiceResponse response = future.get();
}
}
}
// [END servicedirectory_v1_generated_lookupserviceclient_resolveservice_async]
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_lookupserviceclient_resolveservice_sync]
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.ResolveServiceRequest;
import com.google.cloud.servicedirectory.v1.ResolveServiceResponse;
import com.google.cloud.servicedirectory.v1.ServiceName;

public class SyncResolveService {

public static void main(String[] args) throws Exception {
syncResolveService();
}

public static void syncResolveService() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) {
ResolveServiceRequest request =
ResolveServiceRequest.newBuilder()
.setName(
ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString())
.setMaxEndpoints(2074789987)
.setEndpointFilter("endpointFilter-1834249875")
.build();
ResolveServiceResponse response = lookupServiceClient.resolveService(request);
}
}
}
// [END servicedirectory_v1_generated_lookupserviceclient_resolveservice_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_lookupservicesettings_resolveservice_sync]
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
import java.time.Duration;

public class SyncResolveService {

public static void main(String[] args) throws Exception {
syncResolveService();
}

public static void syncResolveService() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
LookupServiceSettings.Builder lookupServiceSettingsBuilder = LookupServiceSettings.newBuilder();
lookupServiceSettingsBuilder
.resolveServiceSettings()
.setRetrySettings(
lookupServiceSettingsBuilder
.resolveServiceSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
LookupServiceSettings lookupServiceSettings = lookupServiceSettingsBuilder.build();
}
}
// [END servicedirectory_v1_generated_lookupservicesettings_resolveservice_sync]
Original file line number Diff line number Diff line change
@@ -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.servicedirectory.v1.samples;

// [START
// servicedirectory_v1_generated_registrationserviceclient_create_setcredentialsprovider_sync]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.cloud.servicedirectory.v1.RegistrationServiceClient;
import com.google.cloud.servicedirectory.v1.RegistrationServiceSettings;
import com.google.cloud.servicedirectory.v1.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.
RegistrationServiceSettings registrationServiceSettings =
RegistrationServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
RegistrationServiceClient registrationServiceClient =
RegistrationServiceClient.create(registrationServiceSettings);
}
}
// [END servicedirectory_v1_generated_registrationserviceclient_create_setcredentialsprovider_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.servicedirectory.v1.samples;

// [START
// servicedirectory_v1_generated_registrationserviceclient_create_setcredentialsprovider1_sync]
import com.google.cloud.servicedirectory.v1.RegistrationServiceClient;
import com.google.cloud.servicedirectory.v1.RegistrationServiceSettings;

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.
RegistrationServiceSettings registrationServiceSettings =
RegistrationServiceSettings.newBuilder()
.setTransportChannelProvider(
RegistrationServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
RegistrationServiceClient registrationServiceClient =
RegistrationServiceClient.create(registrationServiceSettings);
}
}
// [END servicedirectory_v1_generated_registrationserviceclient_create_setcredentialsprovider1_sync]
Original file line number Diff line number Diff line change
@@ -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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_registrationserviceclient_create_setendpoint_sync]
import com.google.cloud.servicedirectory.v1.RegistrationServiceClient;
import com.google.cloud.servicedirectory.v1.RegistrationServiceSettings;
import com.google.cloud.servicedirectory.v1.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.
RegistrationServiceSettings registrationServiceSettings =
RegistrationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
RegistrationServiceClient registrationServiceClient =
RegistrationServiceClient.create(registrationServiceSettings);
}
}
// [END servicedirectory_v1_generated_registrationserviceclient_create_setendpoint_sync]
Loading

0 comments on commit ceecd91

Please sign in to comment.