Skip to content
Permalink
Browse files
feat: add v1 client (#227)
  • Loading branch information
chingor13 committed Nov 16, 2020
1 parent 2926c88 commit c06a272c0fa377ddde4965fb45f0121dab6f6367
Showing with 39,872 additions and 8 deletions.
  1. +10 −0 google-cloud-servicedirectory-bom/pom.xml
  2. +9 −0 google-cloud-servicedirectory/pom.xml
  3. +227 −0 ...loud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/LookupServiceClient.java
  4. +181 −0 ...ud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/LookupServiceSettings.java
  5. +2,107 −0 ...ervicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/RegistrationServiceClient.java
  6. +373 −0 ...vicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/RegistrationServiceSettings.java
  7. +71 −0 google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/package-info.java
  8. +115 −0 ...ory/src/main/java/com/google/cloud/servicedirectory/v1/stub/GrpcLookupServiceCallableFactory.java
  9. +155 −0 ...rvicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/stub/GrpcLookupServiceStub.java
  10. +115 −0 ...c/main/java/com/google/cloud/servicedirectory/v1/stub/GrpcRegistrationServiceCallableFactory.java
  11. +734 −0 ...irectory/src/main/java/com/google/cloud/servicedirectory/v1/stub/GrpcRegistrationServiceStub.java
  12. +41 −0 ...d-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/stub/LookupServiceStub.java
  13. +292 −0 ...edirectory/src/main/java/com/google/cloud/servicedirectory/v1/stub/LookupServiceStubSettings.java
  14. +153 −0 ...icedirectory/src/main/java/com/google/cloud/servicedirectory/v1/stub/RegistrationServiceStub.java
  15. +907 −0 ...tory/src/main/java/com/google/cloud/servicedirectory/v1/stub/RegistrationServiceStubSettings.java
  16. +121 −0 ...-servicedirectory/src/test/java/com/google/cloud/servicedirectory/v1/LookupServiceClientTest.java
  17. +57 −0 ...-cloud-servicedirectory/src/test/java/com/google/cloud/servicedirectory/v1/MockLookupService.java
  18. +73 −0 ...ud-servicedirectory/src/test/java/com/google/cloud/servicedirectory/v1/MockLookupServiceImpl.java
  19. +57 −0 ...-servicedirectory/src/test/java/com/google/cloud/servicedirectory/v1/MockRegistrationService.java
  20. +330 −0 ...vicedirectory/src/test/java/com/google/cloud/servicedirectory/v1/MockRegistrationServiceImpl.java
  21. +895 −0 ...cedirectory/src/test/java/com/google/cloud/servicedirectory/v1/RegistrationServiceClientTest.java
  22. +69 −0 grpc-google-cloud-servicedirectory-v1/pom.xml
  23. +374 −0 ...oud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/LookupServiceGrpc.java
  24. +2,386 −0 ...rvicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/RegistrationServiceGrpc.java
  25. +12 −0 pom.xml
  26. +19 −0 proto-google-cloud-servicedirectory-v1/clirr-ignored-differences.xml
  27. +46 −0 proto-google-cloud-servicedirectory-v1/pom.xml
  28. +1,176 −0 ...servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/CreateEndpointRequest.java
  29. +132 −0 ...rectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/CreateEndpointRequestOrBuilder.java
  30. +1,183 −0 ...ervicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/CreateNamespaceRequest.java
  31. +134 −0 ...ectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/CreateNamespaceRequestOrBuilder.java
  32. +1,176 −0 ...-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/CreateServiceRequest.java
  33. +132 −0 ...irectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/CreateServiceRequestOrBuilder.java
  34. +653 −0 ...servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/DeleteEndpointRequest.java
  35. +54 −0 ...rectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/DeleteEndpointRequestOrBuilder.java
  36. +653 −0 ...ervicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/DeleteNamespaceRequest.java
  37. +54 −0 ...ectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/DeleteNamespaceRequestOrBuilder.java
  38. +653 −0 ...-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/DeleteServiceRequest.java
  39. +54 −0 ...irectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/DeleteServiceRequestOrBuilder.java
  40. +1,514 −0 ...google-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/Endpoint.java
  41. +277 −0 ...le-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/EndpointName.java
  42. +258 −0 ...oud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/EndpointOrBuilder.java
  43. +106 −0 ...e-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/EndpointProto.java
  44. +657 −0 ...ud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/GetEndpointRequest.java
  45. +54 −0 ...edirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/GetEndpointRequestOrBuilder.java
  46. +653 −0 ...d-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/GetNamespaceRequest.java
  47. +54 −0 ...directory-v1/src/main/java/com/google/cloud/servicedirectory/v1/GetNamespaceRequestOrBuilder.java
  48. +657 −0 ...oud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/GetServiceRequest.java
  49. +54 −0 ...cedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/GetServiceRequestOrBuilder.java
  50. +1,448 −0 ...-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListEndpointsRequest.java
  51. +190 −0 ...irectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListEndpointsRequestOrBuilder.java
  52. +1,141 −0 ...servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListEndpointsResponse.java
  53. +104 −0 ...rectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListEndpointsResponseOrBuilder.java
  54. +1,483 −0 ...servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListNamespacesRequest.java
  55. +200 −0 ...rectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListNamespacesRequestOrBuilder.java
  56. +1,142 −0 ...ervicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListNamespacesResponse.java
  57. +104 −0 ...ectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListNamespacesResponseOrBuilder.java
  58. +1,434 −0 ...d-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListServicesRequest.java
  59. +186 −0 ...directory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListServicesRequestOrBuilder.java
  60. +1,140 −0 ...-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListServicesResponse.java
  61. +104 −0 ...irectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ListServicesResponseOrBuilder.java
  62. +182 −0 ...le-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/LocationName.java
  63. +118 −0 ...ud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/LookupServiceProto.java
  64. +991 −0 ...oogle-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/Namespace.java
  65. +211 −0 ...e-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/NamespaceName.java
  66. +116 −0 ...ud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/NamespaceOrBuilder.java
  67. +104 −0 ...-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/NamespaceProto.java
  68. +474 −0 ...vicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/RegistrationServiceProto.java
  69. +1,037 −0 ...servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ResolveServiceRequest.java
  70. +124 −0 ...rectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ResolveServiceRequestOrBuilder.java
  71. +649 −0 ...ervicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ResolveServiceResponse.java
  72. +40 −0 ...ectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ResolveServiceResponseOrBuilder.java
  73. +1,792 −0 ...-google-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/Service.java
  74. +242 −0 ...gle-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ServiceName.java
  75. +283 −0 ...loud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ServiceOrBuilder.java
  76. +108 −0 ...le-cloud-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/ServiceProto.java
  77. +1,045 −0 ...servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/UpdateEndpointRequest.java
  78. +104 −0 ...rectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/UpdateEndpointRequestOrBuilder.java
  79. +1,045 −0 ...ervicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/UpdateNamespaceRequest.java
  80. +104 −0 ...ectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/UpdateNamespaceRequestOrBuilder.java
  81. +1,045 −0 ...-servicedirectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/UpdateServiceRequest.java
  82. +104 −0 ...irectory-v1/src/main/java/com/google/cloud/servicedirectory/v1/UpdateServiceRequestOrBuilder.java
  83. +75 −0 ...o-google-cloud-servicedirectory-v1/src/main/proto/google/cloud/servicedirectory/v1/endpoint.proto
  84. +93 −0 ...le-cloud-servicedirectory-v1/src/main/proto/google/cloud/servicedirectory/v1/lookup_service.proto
  85. +49 −0 ...-google-cloud-servicedirectory-v1/src/main/proto/google/cloud/servicedirectory/v1/namespace.proto
  86. +595 −0 ...ud-servicedirectory-v1/src/main/proto/google/cloud/servicedirectory/v1/registration_service.proto
  87. +74 −0 proto-google-cloud-servicedirectory-v1/src/main/proto/google/cloud/servicedirectory/v1/service.proto
  88. +19 −0 proto-google-cloud-servicedirectory-v1beta1/clirr-ignored-differences.xml
  89. +103 −5 synth.metadata
  90. +1 −3 synth.py
  91. +2 −0 versions.txt
@@ -71,11 +71,21 @@
<artifactId>grpc-google-cloud-servicedirectory-v1beta1</artifactId>
<version>0.2.9-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-servicedirectory-v1beta1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-servicedirectory-v1</artifactId>
<version>0.2.9-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-servicedirectory-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-servicedirectory-v1beta1</artifactId>
<version>0.2.9-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-servicedirectory-v1beta1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-servicedirectory-v1</artifactId>
<version>0.2.9-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-servicedirectory-v1:current} -->
</dependency>
</dependencies>
</dependencyManagement>

@@ -50,6 +50,10 @@
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-servicedirectory-v1beta1</artifactId>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-servicedirectory-v1</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
@@ -79,6 +83,11 @@
<artifactId>grpc-google-cloud-servicedirectory-v1beta1</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-servicedirectory-v1</artifactId>
<scope>test</scope>
</dependency>
<!-- Need testing utility classes for generated gRPC clients tests -->
<dependency>
<groupId>com.google.api</groupId>
@@ -0,0 +1,227 @@
/*
* Copyright 2020 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;

import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.servicedirectory.v1.stub.LookupServiceStub;
import com.google.cloud.servicedirectory.v1.stub.LookupServiceStubSettings;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND SERVICE
/**
* Service Description: Service Directory API for looking up service data at runtime.
*
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>
* <code>
* try (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) {
* ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]");
* ResolveServiceRequest request = ResolveServiceRequest.newBuilder()
* .setName(name.toString())
* .build();
* ResolveServiceResponse response = lookupServiceClient.resolveService(request);
* }
* </code>
* </pre>
*
* <p>Note: close() needs to be called on the lookupServiceClient object to clean up resources such
* as threads. In the example above, try-with-resources is used, which automatically calls close().
*
* <p>The surface of this class includes several types of Java methods for each of the API's
* methods:
*
* <ol>
* <li>A "flattened" method. With this type of method, the fields of the request type have been
* converted into function parameters. It may be the case that not all fields are available as
* parameters, and not every API method will have a flattened method entry point.
* <li>A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
* <li>A "callable" method. This type of method takes no parameters and returns an immutable API
* callable object, which can be used to initiate calls to the service.
* </ol>
*
* <p>See the individual methods for example code.
*
* <p>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 parse
* method to extract the individual identifiers contained within names that are returned.
*
* <p>This class can be customized by passing in a custom instance of LookupServiceSettings to
* create(). For example:
*
* <p>To customize credentials:
*
* <pre>
* <code>
* LookupServiceSettings lookupServiceSettings =
* LookupServiceSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* LookupServiceClient lookupServiceClient =
* LookupServiceClient.create(lookupServiceSettings);
* </code>
* </pre>
*
* To customize the endpoint:
*
* <pre>
* <code>
* LookupServiceSettings lookupServiceSettings =
* LookupServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
* LookupServiceClient lookupServiceClient =
* LookupServiceClient.create(lookupServiceSettings);
* </code>
* </pre>
*/
@Generated("by gapic-generator")
@BetaApi
public class LookupServiceClient implements BackgroundResource {
private final LookupServiceSettings settings;
private final LookupServiceStub stub;

/** Constructs an instance of LookupServiceClient with default settings. */
public static final LookupServiceClient create() throws IOException {
return create(LookupServiceSettings.newBuilder().build());
}

/**
* Constructs an instance of LookupServiceClient, using the given settings. The channels are
* created based on the settings passed in, or defaults for any settings that are not set.
*/
public static final LookupServiceClient create(LookupServiceSettings settings)
throws IOException {
return new LookupServiceClient(settings);
}

/**
* Constructs an instance of LookupServiceClient, using the given stub for making calls. This is
* for advanced usage - prefer to use LookupServiceSettings}.
*/
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final LookupServiceClient create(LookupServiceStub stub) {
return new LookupServiceClient(stub);
}

/**
* Constructs an instance of LookupServiceClient, using the given settings. This is protected so
* that it is easy to make a subclass, but otherwise, the static factory methods should be
* preferred.
*/
protected LookupServiceClient(LookupServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((LookupServiceStubSettings) settings.getStubSettings()).createStub();
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected LookupServiceClient(LookupServiceStub stub) {
this.settings = null;
this.stub = stub;
}

public final LookupServiceSettings getSettings() {
return settings;
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public LookupServiceStub getStub() {
return stub;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns a [service][google.cloud.servicedirectory.v1.Service] and its associated endpoints.
* Resolving a service is not considered an active developer method.
*
* <p>Sample code:
*
* <pre><code>
* try (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) {
* ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]");
* ResolveServiceRequest request = ResolveServiceRequest.newBuilder()
* .setName(name.toString())
* .build();
* ResolveServiceResponse response = lookupServiceClient.resolveService(request);
* }
* </code></pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ResolveServiceResponse resolveService(ResolveServiceRequest request) {
return resolveServiceCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns a [service][google.cloud.servicedirectory.v1.Service] and its associated endpoints.
* Resolving a service is not considered an active developer method.
*
* <p>Sample code:
*
* <pre><code>
* try (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) {
* ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]");
* ResolveServiceRequest request = ResolveServiceRequest.newBuilder()
* .setName(name.toString())
* .build();
* ApiFuture&lt;ResolveServiceResponse&gt; future = lookupServiceClient.resolveServiceCallable().futureCall(request);
* // Do something
* ResolveServiceResponse response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<ResolveServiceRequest, ResolveServiceResponse>
resolveServiceCallable() {
return stub.resolveServiceCallable();
}

@Override
public final void close() {
stub.close();
}

@Override
public void shutdown() {
stub.shutdown();
}

@Override
public boolean isShutdown() {
return stub.isShutdown();
}

@Override
public boolean isTerminated() {
return stub.isTerminated();
}

@Override
public void shutdownNow() {
stub.shutdownNow();
}

@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
}

0 comments on commit c06a272

Please sign in to comment.