diff --git a/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/LookupServiceClient.java b/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/LookupServiceClient.java index 752f3269..9f6d5ecc 100644 --- a/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/LookupServiceClient.java +++ b/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/LookupServiceClient.java @@ -32,6 +32,19 @@ *
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: * + *
{@code + * 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); + * } + * }+ * *
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(). * @@ -136,6 +149,21 @@ public LookupServiceStub getStub() { * Returns a [service][google.cloud.servicedirectory.v1.Service] and its associated endpoints. * Resolving a service is not considered an active developer method. * + *
Sample code: + * + *
{@code + * 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); + * } + * }+ * * @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 */ @@ -149,6 +177,22 @@ public final ResolveServiceResponse resolveService(ResolveServiceRequest request * Resolving a service is not considered an active developer method. * *
Sample code: + * + *
{@code + * try (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) { + * ResolveServiceRequest request = + * ResolveServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setMaxEndpoints(2074789987) + * .setEndpointFilter("endpointFilter-1834249875") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * lookupServiceClient.resolveServiceCallable().futureCall(request); + * // Do something. + * ResolveServiceResponse response = future.get(); + * } + * }
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: * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Namespace namespace = Namespace.newBuilder().build(); + * String namespaceId = "namespaceId790852566"; + * Namespace response = + * registrationServiceClient.createNamespace(parent, namespace, namespaceId); + * } + * }+ * *
Note: close() needs to be called on the RegistrationServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -165,6 +175,18 @@ public RegistrationServiceStub getStub() { /** * Creates a namespace, and returns the new Namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Namespace namespace = Namespace.newBuilder().build(); + * String namespaceId = "namespaceId790852566"; + * Namespace response = + * registrationServiceClient.createNamespace(parent, namespace, namespaceId); + * } + * }+ * * @param parent Required. The resource name of the project and location the namespace will be * created in. * @param namespace Required. A namespace with initial fields set. @@ -191,6 +213,18 @@ public final Namespace createNamespace( /** * Creates a namespace, and returns the new Namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * Namespace namespace = Namespace.newBuilder().build(); + * String namespaceId = "namespaceId790852566"; + * Namespace response = + * registrationServiceClient.createNamespace(parent, namespace, namespaceId); + * } + * }+ * * @param parent Required. The resource name of the project and location the namespace will be * created in. * @param namespace Required. A namespace with initial fields set. @@ -216,6 +250,20 @@ public final Namespace createNamespace(String parent, Namespace namespace, Strin /** * Creates a namespace, and returns the new Namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateNamespaceRequest request = + * CreateNamespaceRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setNamespaceId("namespaceId790852566") + * .setNamespace(Namespace.newBuilder().build()) + * .build(); + * Namespace response = registrationServiceClient.createNamespace(request); + * } + * }+ * * @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 */ @@ -228,6 +276,21 @@ public final Namespace createNamespace(CreateNamespaceRequest request) { * Creates a namespace, and returns the new Namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateNamespaceRequest request = + * CreateNamespaceRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setNamespaceId("namespaceId790852566") + * .setNamespace(Namespace.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.createNamespaceCallable().futureCall(request); + * // Do something. + * Namespace response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (Namespace element : registrationServiceClient.listNamespaces(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the project and location whose namespaces we'd * like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -253,6 +327,17 @@ public final ListNamespacesPagedResponse listNamespaces(LocationName parent) { /** * Lists all namespaces. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (Namespace element : registrationServiceClient.listNamespaces(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the project and location whose namespaces we'd * like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -266,6 +351,24 @@ public final ListNamespacesPagedResponse listNamespaces(String parent) { /** * Lists all namespaces. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListNamespacesRequest request = + * ListNamespacesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Namespace element : registrationServiceClient.listNamespaces(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @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 */ @@ -278,6 +381,25 @@ public final ListNamespacesPagedResponse listNamespaces(ListNamespacesRequest re * Lists all namespaces. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListNamespacesRequest request = + * ListNamespacesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.listNamespacesPagedCallable().futureCall(request); + * // Do something. + * for (Namespace element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * while (true) { + * ListNamespacesResponse response = + * registrationServiceClient.listNamespacesCallable().call(request); + * for (Namespace element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * NamespaceName name = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]"); + * Namespace response = registrationServiceClient.getNamespace(name); + * } + * }+ * * @param name Required. The name of the namespace to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -312,6 +461,15 @@ public final Namespace getNamespace(NamespaceName name) { /** * Gets a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString(); + * Namespace response = registrationServiceClient.getNamespace(name); + * } + * }+ * * @param name Required. The name of the namespace to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -324,6 +482,18 @@ public final Namespace getNamespace(String name) { /** * Gets a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetNamespaceRequest request = + * GetNamespaceRequest.newBuilder() + * .setName(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .build(); + * Namespace response = registrationServiceClient.getNamespace(request); + * } + * }+ * * @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 */ @@ -336,6 +506,19 @@ public final Namespace getNamespace(GetNamespaceRequest request) { * Gets a namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetNamespaceRequest request = + * GetNamespaceRequest.newBuilder() + * .setName(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.getNamespaceCallable().futureCall(request); + * // Do something. + * Namespace response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * Namespace namespace = Namespace.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Namespace response = registrationServiceClient.updateNamespace(namespace, updateMask); + * } + * }+ * * @param namespace Required. The updated namespace. * @param updateMask Required. List of fields to be updated in this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -362,6 +555,19 @@ public final Namespace updateNamespace(Namespace namespace, FieldMask updateMask /** * Updates a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateNamespaceRequest request = + * UpdateNamespaceRequest.newBuilder() + * .setNamespace(Namespace.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Namespace response = registrationServiceClient.updateNamespace(request); + * } + * }+ * * @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 */ @@ -374,6 +580,20 @@ public final Namespace updateNamespace(UpdateNamespaceRequest request) { * Updates a namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateNamespaceRequest request = + * UpdateNamespaceRequest.newBuilder() + * .setNamespace(Namespace.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.updateNamespaceCallable().futureCall(request); + * // Do something. + * Namespace response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * NamespaceName name = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]"); + * registrationServiceClient.deleteNamespace(name); + * } + * }+ * * @param name Required. The name of the namespace to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -396,6 +625,15 @@ public final void deleteNamespace(NamespaceName name) { /** * Deletes a namespace. This also deletes all services and endpoints in the namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString(); + * registrationServiceClient.deleteNamespace(name); + * } + * }+ * * @param name Required. The name of the namespace to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -408,6 +646,18 @@ public final void deleteNamespace(String name) { /** * Deletes a namespace. This also deletes all services and endpoints in the namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteNamespaceRequest request = + * DeleteNamespaceRequest.newBuilder() + * .setName(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .build(); + * registrationServiceClient.deleteNamespace(request); + * } + * }+ * * @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 */ @@ -420,6 +670,19 @@ public final void deleteNamespace(DeleteNamespaceRequest request) { * Deletes a namespace. This also deletes all services and endpoints in the namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteNamespaceRequest request = + * DeleteNamespaceRequest.newBuilder() + * .setName(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.deleteNamespaceCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * NamespaceName parent = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]"); + * Service service = Service.newBuilder().build(); + * String serviceId = "serviceId-194185552"; + * Service response = registrationServiceClient.createService(parent, service, serviceId); + * } + * }+ * * @param parent Required. The resource name of the namespace this service will belong to. * @param service Required. A service with initial fields set. * @param serviceId Required. The Resource ID must be 1-63 characters long, and comply with <a @@ -453,6 +727,17 @@ public final Service createService(NamespaceName parent, Service service, String /** * Creates a service, and returns the new Service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString(); + * Service service = Service.newBuilder().build(); + * String serviceId = "serviceId-194185552"; + * Service response = registrationServiceClient.createService(parent, service, serviceId); + * } + * }+ * * @param parent Required. The resource name of the namespace this service will belong to. * @param service Required. A service with initial fields set. * @param serviceId Required. The Resource ID must be 1-63 characters long, and comply with <a @@ -477,6 +762,20 @@ public final Service createService(String parent, Service service, String servic /** * Creates a service, and returns the new Service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateServiceRequest request = + * CreateServiceRequest.newBuilder() + * .setParent(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setServiceId("serviceId-194185552") + * .setService(Service.newBuilder().build()) + * .build(); + * Service response = registrationServiceClient.createService(request); + * } + * }+ * * @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 */ @@ -489,6 +788,21 @@ public final Service createService(CreateServiceRequest request) { * Creates a service, and returns the new Service. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateServiceRequest request = + * CreateServiceRequest.newBuilder() + * .setParent(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setServiceId("serviceId-194185552") + * .setService(Service.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.createServiceCallable().futureCall(request); + * // Do something. + * Service response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * NamespaceName parent = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]"); + * for (Service element : registrationServiceClient.listServices(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the namespace whose services we'd like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -513,6 +838,17 @@ public final ListServicesPagedResponse listServices(NamespaceName parent) { /** * Lists all services belonging to a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString(); + * for (Service element : registrationServiceClient.listServices(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the namespace whose services we'd like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -525,6 +861,24 @@ public final ListServicesPagedResponse listServices(String parent) { /** * Lists all services belonging to a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListServicesRequest request = + * ListServicesRequest.newBuilder() + * .setParent(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Service element : registrationServiceClient.listServices(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @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 */ @@ -537,6 +891,25 @@ public final ListServicesPagedResponse listServices(ListServicesRequest request) * Lists all services belonging to a namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListServicesRequest request = + * ListServicesRequest.newBuilder() + * .setParent(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.listServicesPagedCallable().futureCall(request); + * // Do something. + * for (Service element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * while (true) { + * ListServicesResponse response = + * registrationServiceClient.listServicesCallable().call(request); + * for (Service element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"); + * Service response = registrationServiceClient.getService(name); + * } + * }+ * * @param name Required. The name of the service to get. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -570,6 +970,16 @@ public final Service getService(ServiceName name) { /** * Gets a service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString(); + * Service response = registrationServiceClient.getService(name); + * } + * }+ * * @param name Required. The name of the service to get. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -582,6 +992,19 @@ public final Service getService(String name) { /** * Gets a service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetServiceRequest request = + * GetServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .build(); + * Service response = registrationServiceClient.getService(request); + * } + * }+ * * @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 */ @@ -594,6 +1017,20 @@ public final Service getService(GetServiceRequest request) { * Gets a service. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetServiceRequest request = + * GetServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.getServiceCallable().futureCall(request); + * // Do something. + * Service response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * Service service = Service.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Service response = registrationServiceClient.updateService(service, updateMask); + * } + * }+ * * @param service Required. The updated service. * @param updateMask Required. List of fields to be updated in this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -617,6 +1064,19 @@ public final Service updateService(Service service, FieldMask updateMask) { /** * Updates a service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateServiceRequest request = + * UpdateServiceRequest.newBuilder() + * .setService(Service.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Service response = registrationServiceClient.updateService(request); + * } + * }+ * * @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 */ @@ -629,6 +1089,20 @@ public final Service updateService(UpdateServiceRequest request) { * Updates a service. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateServiceRequest request = + * UpdateServiceRequest.newBuilder() + * .setService(Service.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.updateServiceCallable().futureCall(request); + * // Do something. + * Service response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"); + * registrationServiceClient.deleteService(name); + * } + * }+ * * @param name Required. The name of the service to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -651,6 +1134,16 @@ public final void deleteService(ServiceName name) { /** * Deletes a service. This also deletes all endpoints associated with the service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString(); + * registrationServiceClient.deleteService(name); + * } + * }+ * * @param name Required. The name of the service to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -663,6 +1156,19 @@ public final void deleteService(String name) { /** * Deletes a service. This also deletes all endpoints associated with the service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteServiceRequest request = + * DeleteServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .build(); + * registrationServiceClient.deleteService(request); + * } + * }+ * * @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 */ @@ -675,6 +1181,20 @@ public final void deleteService(DeleteServiceRequest request) { * Deletes a service. This also deletes all endpoints associated with the service. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteServiceRequest request = + * DeleteServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.deleteServiceCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ServiceName parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"); + * Endpoint endpoint = Endpoint.newBuilder().build(); + * String endpointId = "endpointId-1837754992"; + * Endpoint response = registrationServiceClient.createEndpoint(parent, endpoint, endpointId); + * } + * }+ * * @param parent Required. The resource name of the service that this endpoint provides. * @param endpoint Required. A endpoint with initial fields set. * @param endpointId Required. The Resource ID must be 1-63 characters long, and comply with <a @@ -708,6 +1239,18 @@ public final Endpoint createEndpoint(ServiceName parent, Endpoint endpoint, Stri /** * Creates a endpoint, and returns the new Endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString(); + * Endpoint endpoint = Endpoint.newBuilder().build(); + * String endpointId = "endpointId-1837754992"; + * Endpoint response = registrationServiceClient.createEndpoint(parent, endpoint, endpointId); + * } + * }+ * * @param parent Required. The resource name of the service that this endpoint provides. * @param endpoint Required. A endpoint with initial fields set. * @param endpointId Required. The Resource ID must be 1-63 characters long, and comply with <a @@ -732,6 +1275,21 @@ public final Endpoint createEndpoint(String parent, Endpoint endpoint, String en /** * Creates a endpoint, and returns the new Endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateEndpointRequest request = + * CreateEndpointRequest.newBuilder() + * .setParent( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setEndpointId("endpointId-1837754992") + * .setEndpoint(Endpoint.newBuilder().build()) + * .build(); + * Endpoint response = registrationServiceClient.createEndpoint(request); + * } + * }+ * * @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 */ @@ -744,6 +1302,22 @@ public final Endpoint createEndpoint(CreateEndpointRequest request) { * Creates a endpoint, and returns the new Endpoint. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateEndpointRequest request = + * CreateEndpointRequest.newBuilder() + * .setParent( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setEndpointId("endpointId-1837754992") + * .setEndpoint(Endpoint.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.createEndpointCallable().futureCall(request); + * // Do something. + * Endpoint response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ServiceName parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"); + * for (Endpoint element : registrationServiceClient.listEndpoints(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the service whose endpoints we'd like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -768,6 +1353,18 @@ public final ListEndpointsPagedResponse listEndpoints(ServiceName parent) { /** * Lists all endpoints. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString(); + * for (Endpoint element : registrationServiceClient.listEndpoints(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the service whose endpoints we'd like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -780,6 +1377,25 @@ public final ListEndpointsPagedResponse listEndpoints(String parent) { /** * Lists all endpoints. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListEndpointsRequest request = + * ListEndpointsRequest.newBuilder() + * .setParent( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Endpoint element : registrationServiceClient.listEndpoints(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @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 */ @@ -792,6 +1408,26 @@ public final ListEndpointsPagedResponse listEndpoints(ListEndpointsRequest reque * Lists all endpoints. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListEndpointsRequest request = + * ListEndpointsRequest.newBuilder() + * .setParent( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.listEndpointsPagedCallable().futureCall(request); + * // Do something. + * for (Endpoint element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * while (true) { + * ListEndpointsResponse response = + * registrationServiceClient.listEndpointsCallable().call(request); + * for (Endpoint element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * EndpointName name = + * EndpointName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]"); + * Endpoint response = registrationServiceClient.getEndpoint(name); + * } + * }+ * * @param name Required. The name of the endpoint to get. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -825,6 +1489,17 @@ public final Endpoint getEndpoint(EndpointName name) { /** * Gets a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = + * EndpointName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString(); + * Endpoint response = registrationServiceClient.getEndpoint(name); + * } + * }+ * * @param name Required. The name of the endpoint to get. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -837,6 +1512,21 @@ public final Endpoint getEndpoint(String name) { /** * Gets a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetEndpointRequest request = + * GetEndpointRequest.newBuilder() + * .setName( + * EndpointName.of( + * "[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString()) + * .build(); + * Endpoint response = registrationServiceClient.getEndpoint(request); + * } + * }+ * * @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 */ @@ -849,6 +1539,22 @@ public final Endpoint getEndpoint(GetEndpointRequest request) { * Gets a endpoint. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetEndpointRequest request = + * GetEndpointRequest.newBuilder() + * .setName( + * EndpointName.of( + * "[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.getEndpointCallable().futureCall(request); + * // Do something. + * Endpoint response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * Endpoint endpoint = Endpoint.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Endpoint response = registrationServiceClient.updateEndpoint(endpoint, updateMask); + * } + * }+ * * @param endpoint Required. The updated endpoint. * @param updateMask Required. List of fields to be updated in this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -872,6 +1588,19 @@ public final Endpoint updateEndpoint(Endpoint endpoint, FieldMask updateMask) { /** * Updates a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateEndpointRequest request = + * UpdateEndpointRequest.newBuilder() + * .setEndpoint(Endpoint.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Endpoint response = registrationServiceClient.updateEndpoint(request); + * } + * }+ * * @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 */ @@ -884,6 +1613,20 @@ public final Endpoint updateEndpoint(UpdateEndpointRequest request) { * Updates a endpoint. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateEndpointRequest request = + * UpdateEndpointRequest.newBuilder() + * .setEndpoint(Endpoint.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.updateEndpointCallable().futureCall(request); + * // Do something. + * Endpoint response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * EndpointName name = + * EndpointName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]"); + * registrationServiceClient.deleteEndpoint(name); + * } + * }+ * * @param name Required. The name of the endpoint to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -906,6 +1659,17 @@ public final void deleteEndpoint(EndpointName name) { /** * Deletes a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = + * EndpointName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString(); + * registrationServiceClient.deleteEndpoint(name); + * } + * }+ * * @param name Required. The name of the endpoint to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -918,6 +1682,21 @@ public final void deleteEndpoint(String name) { /** * Deletes a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteEndpointRequest request = + * DeleteEndpointRequest.newBuilder() + * .setName( + * EndpointName.of( + * "[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString()) + * .build(); + * registrationServiceClient.deleteEndpoint(request); + * } + * }+ * * @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 */ @@ -930,6 +1709,22 @@ public final void deleteEndpoint(DeleteEndpointRequest request) { * Deletes a endpoint. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteEndpointRequest request = + * DeleteEndpointRequest.newBuilder() + * .setName( + * EndpointName.of( + * "[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.deleteEndpointCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * Policy response = registrationServiceClient.getIamPolicy(request); + * } + * }+ * * @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 */ @@ -951,6 +1760,21 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { * Gets the IAM Policy for a resource (namespace or service only). * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.getIamPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setPolicy(Policy.newBuilder().build()) + * .build(); + * Policy response = registrationServiceClient.setIamPolicy(request); + * } + * }+ * * @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 */ @@ -972,6 +1810,21 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { * Sets the IAM Policy for a resource (namespace or service only). * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setPolicy(Policy.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.setIamPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .addAllPermissions(new ArrayList+ * * @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 */ @@ -993,6 +1860,21 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * Tests IAM permissions for a resource (namespace or service only). * *()) + * .build(); + * TestIamPermissionsResponse response = registrationServiceClient.testIamPermissions(request); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .addAllPermissions(new ArrayList*/ public final UnaryCallable()) + * .build(); + * ApiFuture future = + * registrationServiceClient.testIamPermissionsCallable().futureCall(request); + * // Do something. + * TestIamPermissionsResponse response = future.get(); + * } + * }
Sample for LookupServiceClient: * + *
{@code + * 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); + * } + * }+ * *
======================= RegistrationServiceClient ======================= * *
Service Description: Service Directory API for registering services. It defines the following @@ -39,6 +52,16 @@ * `projects/*/locations/*/namespaces/*/services/*/endpoints/*`. * *
Sample for RegistrationServiceClient: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Namespace namespace = Namespace.newBuilder().build(); + * String namespaceId = "namespaceId790852566"; + * Namespace response = + * registrationServiceClient.createNamespace(parent, namespace, namespaceId); + * } + * }*/ @Generated("by gapic-generator-java") package com.google.cloud.servicedirectory.v1; diff --git a/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/stub/GrpcLookupServiceStub.java b/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/stub/GrpcLookupServiceStub.java index 9f2e7c03..1c54778b 100644 --- a/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/stub/GrpcLookupServiceStub.java +++ b/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1/stub/GrpcLookupServiceStub.java @@ -124,6 +124,7 @@ public GrpcOperationsStub getOperationsStub() { return operationsStub; } + @Override public UnaryCallable
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: * + *
{@code + * 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); + * } + * }+ * *
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(). * @@ -137,6 +150,21 @@ public LookupServiceStub getStub() { * Returns a [service][google.cloud.servicedirectory.v1beta1.Service] and its associated * endpoints. Resolving a service is not considered an active developer method. * + *
Sample code: + * + *
{@code + * 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); + * } + * }+ * * @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 */ @@ -150,6 +178,22 @@ public final ResolveServiceResponse resolveService(ResolveServiceRequest request * endpoints. Resolving a service is not considered an active developer method. * *
Sample code: + * + *
{@code + * try (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) { + * ResolveServiceRequest request = + * ResolveServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setMaxEndpoints(2074789987) + * .setEndpointFilter("endpointFilter-1834249875") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * lookupServiceClient.resolveServiceCallable().futureCall(request); + * // Do something. + * ResolveServiceResponse response = future.get(); + * } + * }
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: * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Namespace namespace = Namespace.newBuilder().build(); + * String namespaceId = "namespaceId790852566"; + * Namespace response = + * registrationServiceClient.createNamespace(parent, namespace, namespaceId); + * } + * }+ * *
Note: close() needs to be called on the RegistrationServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -166,6 +176,18 @@ public RegistrationServiceStub getStub() { /** * Creates a namespace, and returns the new Namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Namespace namespace = Namespace.newBuilder().build(); + * String namespaceId = "namespaceId790852566"; + * Namespace response = + * registrationServiceClient.createNamespace(parent, namespace, namespaceId); + * } + * }+ * * @param parent Required. The resource name of the project and location the namespace will be * created in. * @param namespace Required. A namespace with initial fields set. @@ -192,6 +214,18 @@ public final Namespace createNamespace( /** * Creates a namespace, and returns the new Namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * Namespace namespace = Namespace.newBuilder().build(); + * String namespaceId = "namespaceId790852566"; + * Namespace response = + * registrationServiceClient.createNamespace(parent, namespace, namespaceId); + * } + * }+ * * @param parent Required. The resource name of the project and location the namespace will be * created in. * @param namespace Required. A namespace with initial fields set. @@ -217,6 +251,20 @@ public final Namespace createNamespace(String parent, Namespace namespace, Strin /** * Creates a namespace, and returns the new Namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateNamespaceRequest request = + * CreateNamespaceRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setNamespaceId("namespaceId790852566") + * .setNamespace(Namespace.newBuilder().build()) + * .build(); + * Namespace response = registrationServiceClient.createNamespace(request); + * } + * }+ * * @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 */ @@ -229,6 +277,21 @@ public final Namespace createNamespace(CreateNamespaceRequest request) { * Creates a namespace, and returns the new Namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateNamespaceRequest request = + * CreateNamespaceRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setNamespaceId("namespaceId790852566") + * .setNamespace(Namespace.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.createNamespaceCallable().futureCall(request); + * // Do something. + * Namespace response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (Namespace element : registrationServiceClient.listNamespaces(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the project and location whose namespaces we'd * like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -254,6 +328,17 @@ public final ListNamespacesPagedResponse listNamespaces(LocationName parent) { /** * Lists all namespaces. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (Namespace element : registrationServiceClient.listNamespaces(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the project and location whose namespaces we'd * like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -267,6 +352,24 @@ public final ListNamespacesPagedResponse listNamespaces(String parent) { /** * Lists all namespaces. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListNamespacesRequest request = + * ListNamespacesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Namespace element : registrationServiceClient.listNamespaces(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @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 */ @@ -279,6 +382,25 @@ public final ListNamespacesPagedResponse listNamespaces(ListNamespacesRequest re * Lists all namespaces. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListNamespacesRequest request = + * ListNamespacesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.listNamespacesPagedCallable().futureCall(request); + * // Do something. + * for (Namespace element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * while (true) { + * ListNamespacesResponse response = + * registrationServiceClient.listNamespacesCallable().call(request); + * for (Namespace element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * NamespaceName name = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]"); + * Namespace response = registrationServiceClient.getNamespace(name); + * } + * }+ * * @param name Required. The name of the namespace to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -313,6 +462,15 @@ public final Namespace getNamespace(NamespaceName name) { /** * Gets a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString(); + * Namespace response = registrationServiceClient.getNamespace(name); + * } + * }+ * * @param name Required. The name of the namespace to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -325,6 +483,18 @@ public final Namespace getNamespace(String name) { /** * Gets a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetNamespaceRequest request = + * GetNamespaceRequest.newBuilder() + * .setName(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .build(); + * Namespace response = registrationServiceClient.getNamespace(request); + * } + * }+ * * @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 */ @@ -337,6 +507,19 @@ public final Namespace getNamespace(GetNamespaceRequest request) { * Gets a namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetNamespaceRequest request = + * GetNamespaceRequest.newBuilder() + * .setName(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.getNamespaceCallable().futureCall(request); + * // Do something. + * Namespace response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * Namespace namespace = Namespace.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Namespace response = registrationServiceClient.updateNamespace(namespace, updateMask); + * } + * }+ * * @param namespace Required. The updated namespace. * @param updateMask Required. List of fields to be updated in this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -363,6 +556,19 @@ public final Namespace updateNamespace(Namespace namespace, FieldMask updateMask /** * Updates a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateNamespaceRequest request = + * UpdateNamespaceRequest.newBuilder() + * .setNamespace(Namespace.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Namespace response = registrationServiceClient.updateNamespace(request); + * } + * }+ * * @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 */ @@ -375,6 +581,20 @@ public final Namespace updateNamespace(UpdateNamespaceRequest request) { * Updates a namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateNamespaceRequest request = + * UpdateNamespaceRequest.newBuilder() + * .setNamespace(Namespace.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.updateNamespaceCallable().futureCall(request); + * // Do something. + * Namespace response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * NamespaceName name = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]"); + * registrationServiceClient.deleteNamespace(name); + * } + * }+ * * @param name Required. The name of the namespace to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -397,6 +626,15 @@ public final void deleteNamespace(NamespaceName name) { /** * Deletes a namespace. This also deletes all services and endpoints in the namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString(); + * registrationServiceClient.deleteNamespace(name); + * } + * }+ * * @param name Required. The name of the namespace to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -409,6 +647,18 @@ public final void deleteNamespace(String name) { /** * Deletes a namespace. This also deletes all services and endpoints in the namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteNamespaceRequest request = + * DeleteNamespaceRequest.newBuilder() + * .setName(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .build(); + * registrationServiceClient.deleteNamespace(request); + * } + * }+ * * @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 */ @@ -421,6 +671,19 @@ public final void deleteNamespace(DeleteNamespaceRequest request) { * Deletes a namespace. This also deletes all services and endpoints in the namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteNamespaceRequest request = + * DeleteNamespaceRequest.newBuilder() + * .setName(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.deleteNamespaceCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * NamespaceName parent = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]"); + * Service service = Service.newBuilder().build(); + * String serviceId = "serviceId-194185552"; + * Service response = registrationServiceClient.createService(parent, service, serviceId); + * } + * }+ * * @param parent Required. The resource name of the namespace this service will belong to. * @param service Required. A service with initial fields set. * @param serviceId Required. The Resource ID must be 1-63 characters long, and comply with <a @@ -454,6 +728,17 @@ public final Service createService(NamespaceName parent, Service service, String /** * Creates a service, and returns the new Service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString(); + * Service service = Service.newBuilder().build(); + * String serviceId = "serviceId-194185552"; + * Service response = registrationServiceClient.createService(parent, service, serviceId); + * } + * }+ * * @param parent Required. The resource name of the namespace this service will belong to. * @param service Required. A service with initial fields set. * @param serviceId Required. The Resource ID must be 1-63 characters long, and comply with <a @@ -478,6 +763,20 @@ public final Service createService(String parent, Service service, String servic /** * Creates a service, and returns the new Service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateServiceRequest request = + * CreateServiceRequest.newBuilder() + * .setParent(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setServiceId("serviceId-194185552") + * .setService(Service.newBuilder().build()) + * .build(); + * Service response = registrationServiceClient.createService(request); + * } + * }+ * * @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 */ @@ -490,6 +789,21 @@ public final Service createService(CreateServiceRequest request) { * Creates a service, and returns the new Service. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateServiceRequest request = + * CreateServiceRequest.newBuilder() + * .setParent(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setServiceId("serviceId-194185552") + * .setService(Service.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.createServiceCallable().futureCall(request); + * // Do something. + * Service response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * NamespaceName parent = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]"); + * for (Service element : registrationServiceClient.listServices(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the namespace whose services we'd like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -514,6 +839,17 @@ public final ListServicesPagedResponse listServices(NamespaceName parent) { /** * Lists all services belonging to a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString(); + * for (Service element : registrationServiceClient.listServices(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the namespace whose services we'd like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -526,6 +862,24 @@ public final ListServicesPagedResponse listServices(String parent) { /** * Lists all services belonging to a namespace. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListServicesRequest request = + * ListServicesRequest.newBuilder() + * .setParent(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Service element : registrationServiceClient.listServices(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @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 */ @@ -538,6 +892,25 @@ public final ListServicesPagedResponse listServices(ListServicesRequest request) * Lists all services belonging to a namespace. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListServicesRequest request = + * ListServicesRequest.newBuilder() + * .setParent(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.listServicesPagedCallable().futureCall(request); + * // Do something. + * for (Service element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * while (true) { + * ListServicesResponse response = + * registrationServiceClient.listServicesCallable().call(request); + * for (Service element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"); + * Service response = registrationServiceClient.getService(name); + * } + * }+ * * @param name Required. The name of the service to get. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -571,6 +971,16 @@ public final Service getService(ServiceName name) { /** * Gets a service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString(); + * Service response = registrationServiceClient.getService(name); + * } + * }+ * * @param name Required. The name of the service to get. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -583,6 +993,19 @@ public final Service getService(String name) { /** * Gets a service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetServiceRequest request = + * GetServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .build(); + * Service response = registrationServiceClient.getService(request); + * } + * }+ * * @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 */ @@ -595,6 +1018,20 @@ public final Service getService(GetServiceRequest request) { * Gets a service. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetServiceRequest request = + * GetServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.getServiceCallable().futureCall(request); + * // Do something. + * Service response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * Service service = Service.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Service response = registrationServiceClient.updateService(service, updateMask); + * } + * }+ * * @param service Required. The updated service. * @param updateMask Required. List of fields to be updated in this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -618,6 +1065,19 @@ public final Service updateService(Service service, FieldMask updateMask) { /** * Updates a service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateServiceRequest request = + * UpdateServiceRequest.newBuilder() + * .setService(Service.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Service response = registrationServiceClient.updateService(request); + * } + * }+ * * @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 */ @@ -630,6 +1090,20 @@ public final Service updateService(UpdateServiceRequest request) { * Updates a service. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateServiceRequest request = + * UpdateServiceRequest.newBuilder() + * .setService(Service.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.updateServiceCallable().futureCall(request); + * // Do something. + * Service response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"); + * registrationServiceClient.deleteService(name); + * } + * }+ * * @param name Required. The name of the service to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -652,6 +1135,16 @@ public final void deleteService(ServiceName name) { /** * Deletes a service. This also deletes all endpoints associated with the service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString(); + * registrationServiceClient.deleteService(name); + * } + * }+ * * @param name Required. The name of the service to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -664,6 +1157,19 @@ public final void deleteService(String name) { /** * Deletes a service. This also deletes all endpoints associated with the service. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteServiceRequest request = + * DeleteServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .build(); + * registrationServiceClient.deleteService(request); + * } + * }+ * * @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 */ @@ -676,6 +1182,20 @@ public final void deleteService(DeleteServiceRequest request) { * Deletes a service. This also deletes all endpoints associated with the service. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteServiceRequest request = + * DeleteServiceRequest.newBuilder() + * .setName( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.deleteServiceCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ServiceName parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"); + * Endpoint endpoint = Endpoint.newBuilder().build(); + * String endpointId = "endpointId-1837754992"; + * Endpoint response = registrationServiceClient.createEndpoint(parent, endpoint, endpointId); + * } + * }+ * * @param parent Required. The resource name of the service that this endpoint provides. * @param endpoint Required. A endpoint with initial fields set. * @param endpointId Required. The Resource ID must be 1-63 characters long, and comply with <a @@ -709,6 +1240,18 @@ public final Endpoint createEndpoint(ServiceName parent, Endpoint endpoint, Stri /** * Creates a endpoint, and returns the new Endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString(); + * Endpoint endpoint = Endpoint.newBuilder().build(); + * String endpointId = "endpointId-1837754992"; + * Endpoint response = registrationServiceClient.createEndpoint(parent, endpoint, endpointId); + * } + * }+ * * @param parent Required. The resource name of the service that this endpoint provides. * @param endpoint Required. A endpoint with initial fields set. * @param endpointId Required. The Resource ID must be 1-63 characters long, and comply with <a @@ -733,6 +1276,21 @@ public final Endpoint createEndpoint(String parent, Endpoint endpoint, String en /** * Creates a endpoint, and returns the new Endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateEndpointRequest request = + * CreateEndpointRequest.newBuilder() + * .setParent( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setEndpointId("endpointId-1837754992") + * .setEndpoint(Endpoint.newBuilder().build()) + * .build(); + * Endpoint response = registrationServiceClient.createEndpoint(request); + * } + * }+ * * @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 */ @@ -745,6 +1303,22 @@ public final Endpoint createEndpoint(CreateEndpointRequest request) { * Creates a endpoint, and returns the new Endpoint. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * CreateEndpointRequest request = + * CreateEndpointRequest.newBuilder() + * .setParent( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setEndpointId("endpointId-1837754992") + * .setEndpoint(Endpoint.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.createEndpointCallable().futureCall(request); + * // Do something. + * Endpoint response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ServiceName parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"); + * for (Endpoint element : registrationServiceClient.listEndpoints(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the service whose endpoints we'd like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -769,6 +1354,18 @@ public final ListEndpointsPagedResponse listEndpoints(ServiceName parent) { /** * Lists all endpoints. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String parent = + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString(); + * for (Endpoint element : registrationServiceClient.listEndpoints(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the service whose endpoints we'd like to list. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -781,6 +1378,25 @@ public final ListEndpointsPagedResponse listEndpoints(String parent) { /** * Lists all endpoints. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListEndpointsRequest request = + * ListEndpointsRequest.newBuilder() + * .setParent( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Endpoint element : registrationServiceClient.listEndpoints(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @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 */ @@ -793,6 +1409,26 @@ public final ListEndpointsPagedResponse listEndpoints(ListEndpointsRequest reque * Lists all endpoints. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * ListEndpointsRequest request = + * ListEndpointsRequest.newBuilder() + * .setParent( + * ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.listEndpointsPagedCallable().futureCall(request); + * // Do something. + * for (Endpoint element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * while (true) { + * ListEndpointsResponse response = + * registrationServiceClient.listEndpointsCallable().call(request); + * for (Endpoint element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * EndpointName name = + * EndpointName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]"); + * Endpoint response = registrationServiceClient.getEndpoint(name); + * } + * }+ * * @param name Required. The name of the endpoint to get. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -826,6 +1490,17 @@ public final Endpoint getEndpoint(EndpointName name) { /** * Gets a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = + * EndpointName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString(); + * Endpoint response = registrationServiceClient.getEndpoint(name); + * } + * }+ * * @param name Required. The name of the endpoint to get. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -838,6 +1513,21 @@ public final Endpoint getEndpoint(String name) { /** * Gets a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetEndpointRequest request = + * GetEndpointRequest.newBuilder() + * .setName( + * EndpointName.of( + * "[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString()) + * .build(); + * Endpoint response = registrationServiceClient.getEndpoint(request); + * } + * }+ * * @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 */ @@ -850,6 +1540,22 @@ public final Endpoint getEndpoint(GetEndpointRequest request) { * Gets a endpoint. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetEndpointRequest request = + * GetEndpointRequest.newBuilder() + * .setName( + * EndpointName.of( + * "[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.getEndpointCallable().futureCall(request); + * // Do something. + * Endpoint response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * Endpoint endpoint = Endpoint.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Endpoint response = registrationServiceClient.updateEndpoint(endpoint, updateMask); + * } + * }+ * * @param endpoint Required. The updated endpoint. * @param updateMask Required. List of fields to be updated in this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -873,6 +1589,19 @@ public final Endpoint updateEndpoint(Endpoint endpoint, FieldMask updateMask) { /** * Updates a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateEndpointRequest request = + * UpdateEndpointRequest.newBuilder() + * .setEndpoint(Endpoint.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Endpoint response = registrationServiceClient.updateEndpoint(request); + * } + * }+ * * @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 */ @@ -885,6 +1614,20 @@ public final Endpoint updateEndpoint(UpdateEndpointRequest request) { * Updates a endpoint. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * UpdateEndpointRequest request = + * UpdateEndpointRequest.newBuilder() + * .setEndpoint(Endpoint.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.updateEndpointCallable().futureCall(request); + * // Do something. + * Endpoint response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * EndpointName name = + * EndpointName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]"); + * registrationServiceClient.deleteEndpoint(name); + * } + * }+ * * @param name Required. The name of the endpoint to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -907,6 +1660,17 @@ public final void deleteEndpoint(EndpointName name) { /** * Deletes a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * String name = + * EndpointName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString(); + * registrationServiceClient.deleteEndpoint(name); + * } + * }+ * * @param name Required. The name of the endpoint to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -919,6 +1683,21 @@ public final void deleteEndpoint(String name) { /** * Deletes a endpoint. * + *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteEndpointRequest request = + * DeleteEndpointRequest.newBuilder() + * .setName( + * EndpointName.of( + * "[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString()) + * .build(); + * registrationServiceClient.deleteEndpoint(request); + * } + * }+ * * @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 */ @@ -931,6 +1710,22 @@ public final void deleteEndpoint(DeleteEndpointRequest request) { * Deletes a endpoint. * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * DeleteEndpointRequest request = + * DeleteEndpointRequest.newBuilder() + * .setName( + * EndpointName.of( + * "[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]", "[ENDPOINT]") + * .toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.deleteEndpointCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * Policy response = registrationServiceClient.getIamPolicy(request); + * } + * }+ * * @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 */ @@ -952,6 +1760,20 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { * Gets the IAM Policy for a resource (namespace or service only). * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.getIamPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setPolicy(Policy.newBuilder().build()) + * .build(); + * Policy response = registrationServiceClient.setIamPolicy(request); + * } + * }+ * * @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 */ @@ -973,6 +1808,20 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { * Sets the IAM Policy for a resource (namespace or service only). * *
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .setPolicy(Policy.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * registrationServiceClient.setIamPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .addAllPermissions(new ArrayList+ * * @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 */ @@ -994,6 +1856,20 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * Tests IAM permissions for a resource (namespace or service only). * *()) + * .build(); + * TestIamPermissionsResponse response = registrationServiceClient.testIamPermissions(request); + * } + * }
Sample code: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource(NamespaceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]").toString()) + * .addAllPermissions(new ArrayList*/ public final UnaryCallable()) + * .build(); + * ApiFuture future = + * registrationServiceClient.testIamPermissionsCallable().futureCall(request); + * // Do something. + * TestIamPermissionsResponse response = future.get(); + * } + * }
Sample for LookupServiceClient: * + *
{@code + * 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); + * } + * }+ * *
======================= RegistrationServiceClient ======================= * *
Service Description: Service Directory API for registering services. It defines the following @@ -39,6 +52,16 @@ * `projects/*/locations/*/namespaces/*/services/*/endpoints/*`. * *
Sample for RegistrationServiceClient: + * + *
{@code + * try (RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Namespace namespace = Namespace.newBuilder().build(); + * String namespaceId = "namespaceId790852566"; + * Namespace response = + * registrationServiceClient.createNamespace(parent, namespace, namespaceId); + * } + * }*/ @Generated("by gapic-generator-java") package com.google.cloud.servicedirectory.v1beta1; diff --git a/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1beta1/stub/GrpcLookupServiceStub.java b/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1beta1/stub/GrpcLookupServiceStub.java index d84f1f92..efce3a89 100644 --- a/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1beta1/stub/GrpcLookupServiceStub.java +++ b/google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1beta1/stub/GrpcLookupServiceStub.java @@ -127,6 +127,7 @@ public GrpcOperationsStub getOperationsStub() { return operationsStub; } + @Override public UnaryCallable