- 2.56.0 (latest)
- 2.55.0
- 2.54.0
- 2.53.0
- 2.52.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.40.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.5
- 2.2.7
A client to Service Directory API
The interfaces provided are listed below, along with usage samples.
LookupServiceClient
Service Description: Service Directory API for looking up service data at runtime.
Sample for LookupServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
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 resource model:
- The API has a collection of Namespace
resources, named projects/*/locations/*/namespaces/*
.
- Each Namespace has a collection of Service
resources, named projects/*/locations/*/namespaces/*/services/*
.
- Each Service has a collection of Endpoint
resources, named
projects/*/locations/*/namespaces/*/services/*/endpoints/*
.
Sample for RegistrationServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
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);
}
Classes
CreateEndpointRequest
The request message for RegistrationService.CreateEndpoint.
Protobuf type google.cloud.servicedirectory.v1.CreateEndpointRequest
CreateEndpointRequest.Builder
The request message for RegistrationService.CreateEndpoint.
Protobuf type google.cloud.servicedirectory.v1.CreateEndpointRequest
CreateNamespaceRequest
The request message for RegistrationService.CreateNamespace.
Protobuf type google.cloud.servicedirectory.v1.CreateNamespaceRequest
CreateNamespaceRequest.Builder
The request message for RegistrationService.CreateNamespace.
Protobuf type google.cloud.servicedirectory.v1.CreateNamespaceRequest
CreateServiceRequest
The request message for RegistrationService.CreateService.
Protobuf type google.cloud.servicedirectory.v1.CreateServiceRequest
CreateServiceRequest.Builder
The request message for RegistrationService.CreateService.
Protobuf type google.cloud.servicedirectory.v1.CreateServiceRequest
DeleteEndpointRequest
The request message for RegistrationService.DeleteEndpoint.
Protobuf type google.cloud.servicedirectory.v1.DeleteEndpointRequest
DeleteEndpointRequest.Builder
The request message for RegistrationService.DeleteEndpoint.
Protobuf type google.cloud.servicedirectory.v1.DeleteEndpointRequest
DeleteNamespaceRequest
The request message for RegistrationService.DeleteNamespace.
Protobuf type google.cloud.servicedirectory.v1.DeleteNamespaceRequest
DeleteNamespaceRequest.Builder
The request message for RegistrationService.DeleteNamespace.
Protobuf type google.cloud.servicedirectory.v1.DeleteNamespaceRequest
DeleteServiceRequest
The request message for RegistrationService.DeleteService.
Protobuf type google.cloud.servicedirectory.v1.DeleteServiceRequest
DeleteServiceRequest.Builder
The request message for RegistrationService.DeleteService.
Protobuf type google.cloud.servicedirectory.v1.DeleteServiceRequest
Endpoint
An individual endpoint that provides a service. The service must already exist to create an endpoint.
Protobuf type google.cloud.servicedirectory.v1.Endpoint
Endpoint.Builder
An individual endpoint that provides a service. The service must already exist to create an endpoint.
Protobuf type google.cloud.servicedirectory.v1.Endpoint
EndpointName
EndpointName.Builder
Builder for projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}/endpoints/{endpoint}.
EndpointProto
GetEndpointRequest
The request message for
RegistrationService.GetEndpoint.
This should not be used to lookup endpoints at runtime. Instead, use
the resolve
method.
Protobuf type google.cloud.servicedirectory.v1.GetEndpointRequest
GetEndpointRequest.Builder
The request message for
RegistrationService.GetEndpoint.
This should not be used to lookup endpoints at runtime. Instead, use
the resolve
method.
Protobuf type google.cloud.servicedirectory.v1.GetEndpointRequest
GetNamespaceRequest
The request message for RegistrationService.GetNamespace.
Protobuf type google.cloud.servicedirectory.v1.GetNamespaceRequest
GetNamespaceRequest.Builder
The request message for RegistrationService.GetNamespace.
Protobuf type google.cloud.servicedirectory.v1.GetNamespaceRequest
GetServiceRequest
The request message for
RegistrationService.GetService.
This should not be used for looking up a service. Insead, use the resolve
method as it will contain all endpoints and associated metadata.
Protobuf type google.cloud.servicedirectory.v1.GetServiceRequest
GetServiceRequest.Builder
The request message for
RegistrationService.GetService.
This should not be used for looking up a service. Insead, use the resolve
method as it will contain all endpoints and associated metadata.
Protobuf type google.cloud.servicedirectory.v1.GetServiceRequest
ListEndpointsRequest
The request message for RegistrationService.ListEndpoints.
Protobuf type google.cloud.servicedirectory.v1.ListEndpointsRequest
ListEndpointsRequest.Builder
The request message for RegistrationService.ListEndpoints.
Protobuf type google.cloud.servicedirectory.v1.ListEndpointsRequest
ListEndpointsResponse
The response message for RegistrationService.ListEndpoints.
Protobuf type google.cloud.servicedirectory.v1.ListEndpointsResponse
ListEndpointsResponse.Builder
The response message for RegistrationService.ListEndpoints.
Protobuf type google.cloud.servicedirectory.v1.ListEndpointsResponse
ListNamespacesRequest
The request message for RegistrationService.ListNamespaces.
Protobuf type google.cloud.servicedirectory.v1.ListNamespacesRequest
ListNamespacesRequest.Builder
The request message for RegistrationService.ListNamespaces.
Protobuf type google.cloud.servicedirectory.v1.ListNamespacesRequest
ListNamespacesResponse
The response message for RegistrationService.ListNamespaces.
Protobuf type google.cloud.servicedirectory.v1.ListNamespacesResponse
ListNamespacesResponse.Builder
The response message for RegistrationService.ListNamespaces.
Protobuf type google.cloud.servicedirectory.v1.ListNamespacesResponse
ListServicesRequest
The request message for RegistrationService.ListServices.
Protobuf type google.cloud.servicedirectory.v1.ListServicesRequest
ListServicesRequest.Builder
The request message for RegistrationService.ListServices.
Protobuf type google.cloud.servicedirectory.v1.ListServicesRequest
ListServicesResponse
The response message for RegistrationService.ListServices.
Protobuf type google.cloud.servicedirectory.v1.ListServicesResponse
ListServicesResponse.Builder
The response message for RegistrationService.ListServices.
Protobuf type google.cloud.servicedirectory.v1.ListServicesResponse
LocationName
LocationName.Builder
Builder for projects/{project}/locations/{location}.
LookupServiceClient
Service Description: Service Directory API for looking up service data at runtime.
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of LookupServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
LookupServiceSettings lookupServiceSettings =
LookupServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
LookupServiceSettings lookupServiceSettings =
LookupServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
LookupServiceSettings lookupServiceSettings =
LookupServiceSettings.newHttpJsonBuilder().build();
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
LookupServiceGrpc
Service Directory API for looking up service data at runtime.
LookupServiceGrpc.LookupServiceBlockingStub
Service Directory API for looking up service data at runtime.
LookupServiceGrpc.LookupServiceFutureStub
Service Directory API for looking up service data at runtime.
LookupServiceGrpc.LookupServiceImplBase
Service Directory API for looking up service data at runtime.
LookupServiceGrpc.LookupServiceStub
Service Directory API for looking up service data at runtime.
LookupServiceProto
LookupServiceSettings
Settings class to configure an instance of LookupServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (servicedirectory.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of resolveService to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
LookupServiceSettings.Builder lookupServiceSettingsBuilder = LookupServiceSettings.newBuilder();
lookupServiceSettingsBuilder
.resolveServiceSettings()
.setRetrySettings(
lookupServiceSettingsBuilder
.resolveServiceSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
LookupServiceSettings lookupServiceSettings = lookupServiceSettingsBuilder.build();
LookupServiceSettings.Builder
Builder for LookupServiceSettings.
Namespace
A container for services. Namespaces allow administrators to group services together and define permissions for a collection of services.
Protobuf type google.cloud.servicedirectory.v1.Namespace
Namespace.Builder
A container for services. Namespaces allow administrators to group services together and define permissions for a collection of services.
Protobuf type google.cloud.servicedirectory.v1.Namespace
NamespaceName
NamespaceName.Builder
Builder for projects/{project}/locations/{location}/namespaces/{namespace}.
NamespaceProto
RegistrationServiceClient
Service Description: Service Directory API for registering services. It defines the following resource model:
- The API has a collection of Namespace
resources, named projects/*/locations/*/namespaces/*
.
- Each Namespace has a collection of Service
resources, named projects/*/locations/*/namespaces/*/services/*
.
- Each Service has a collection of Endpoint
resources, named
projects/*/locations/*/namespaces/*/services/*/endpoints/*
.
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of RegistrationServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
RegistrationServiceSettings registrationServiceSettings =
RegistrationServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
RegistrationServiceClient registrationServiceClient =
RegistrationServiceClient.create(registrationServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
RegistrationServiceSettings registrationServiceSettings =
RegistrationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
RegistrationServiceClient registrationServiceClient =
RegistrationServiceClient.create(registrationServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
RegistrationServiceSettings registrationServiceSettings =
RegistrationServiceSettings.newHttpJsonBuilder().build();
RegistrationServiceClient registrationServiceClient =
RegistrationServiceClient.create(registrationServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
RegistrationServiceClient.ListEndpointsFixedSizeCollection
RegistrationServiceClient.ListEndpointsPage
RegistrationServiceClient.ListEndpointsPagedResponse
RegistrationServiceClient.ListNamespacesFixedSizeCollection
RegistrationServiceClient.ListNamespacesPage
RegistrationServiceClient.ListNamespacesPagedResponse
RegistrationServiceClient.ListServicesFixedSizeCollection
RegistrationServiceClient.ListServicesPage
RegistrationServiceClient.ListServicesPagedResponse
RegistrationServiceGrpc
Service Directory API for registering services. It defines the following resource model:
- The API has a collection of
Namespace
resources, named
projects/*/locations/*/namespaces/*
. - Each Namespace has a collection of
Service resources, named
projects/*/locations/*/namespaces/*/services/*
. - Each Service has a collection of
Endpoint
resources, named
projects/*/locations/*/namespaces/*/services/*/endpoints/*
.
RegistrationServiceGrpc.RegistrationServiceBlockingStub
Service Directory API for registering services. It defines the following resource model:
- The API has a collection of
Namespace
resources, named
projects/*/locations/*/namespaces/*
. - Each Namespace has a collection of
Service resources, named
projects/*/locations/*/namespaces/*/services/*
. - Each Service has a collection of
Endpoint
resources, named
projects/*/locations/*/namespaces/*/services/*/endpoints/*
.
RegistrationServiceGrpc.RegistrationServiceFutureStub
Service Directory API for registering services. It defines the following resource model:
- The API has a collection of
Namespace
resources, named
projects/*/locations/*/namespaces/*
. - Each Namespace has a collection of
Service resources, named
projects/*/locations/*/namespaces/*/services/*
. - Each Service has a collection of
Endpoint
resources, named
projects/*/locations/*/namespaces/*/services/*/endpoints/*
.
RegistrationServiceGrpc.RegistrationServiceImplBase
Service Directory API for registering services. It defines the following resource model:
- The API has a collection of
Namespace
resources, named
projects/*/locations/*/namespaces/*
. - Each Namespace has a collection of
Service resources, named
projects/*/locations/*/namespaces/*/services/*
. - Each Service has a collection of
Endpoint
resources, named
projects/*/locations/*/namespaces/*/services/*/endpoints/*
.
RegistrationServiceGrpc.RegistrationServiceStub
Service Directory API for registering services. It defines the following resource model:
- The API has a collection of
Namespace
resources, named
projects/*/locations/*/namespaces/*
. - Each Namespace has a collection of
Service resources, named
projects/*/locations/*/namespaces/*/services/*
. - Each Service has a collection of
Endpoint
resources, named
projects/*/locations/*/namespaces/*/services/*/endpoints/*
.
RegistrationServiceProto
RegistrationServiceSettings
Settings class to configure an instance of RegistrationServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (servicedirectory.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of createNamespace to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
RegistrationServiceSettings.Builder registrationServiceSettingsBuilder =
RegistrationServiceSettings.newBuilder();
registrationServiceSettingsBuilder
.createNamespaceSettings()
.setRetrySettings(
registrationServiceSettingsBuilder
.createNamespaceSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
RegistrationServiceSettings registrationServiceSettings =
registrationServiceSettingsBuilder.build();
RegistrationServiceSettings.Builder
Builder for RegistrationServiceSettings.
ResolveServiceRequest
The request message for LookupService.ResolveService. Looks up a service by its name, returns the service and its endpoints.
Protobuf type google.cloud.servicedirectory.v1.ResolveServiceRequest
ResolveServiceRequest.Builder
The request message for LookupService.ResolveService. Looks up a service by its name, returns the service and its endpoints.
Protobuf type google.cloud.servicedirectory.v1.ResolveServiceRequest
ResolveServiceResponse
The response message for LookupService.ResolveService.
Protobuf type google.cloud.servicedirectory.v1.ResolveServiceResponse
ResolveServiceResponse.Builder
The response message for LookupService.ResolveService.
Protobuf type google.cloud.servicedirectory.v1.ResolveServiceResponse
Service
An individual service. A service contains a name and optional metadata. A service must exist before endpoints can be added to it.
Protobuf type google.cloud.servicedirectory.v1.Service
Service.Builder
An individual service. A service contains a name and optional metadata. A service must exist before endpoints can be added to it.
Protobuf type google.cloud.servicedirectory.v1.Service
ServiceName
ServiceName.Builder
Builder for projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}.
ServiceProto
UpdateEndpointRequest
The request message for RegistrationService.UpdateEndpoint.
Protobuf type google.cloud.servicedirectory.v1.UpdateEndpointRequest
UpdateEndpointRequest.Builder
The request message for RegistrationService.UpdateEndpoint.
Protobuf type google.cloud.servicedirectory.v1.UpdateEndpointRequest
UpdateNamespaceRequest
The request message for RegistrationService.UpdateNamespace.
Protobuf type google.cloud.servicedirectory.v1.UpdateNamespaceRequest
UpdateNamespaceRequest.Builder
The request message for RegistrationService.UpdateNamespace.
Protobuf type google.cloud.servicedirectory.v1.UpdateNamespaceRequest
UpdateServiceRequest
The request message for RegistrationService.UpdateService.
Protobuf type google.cloud.servicedirectory.v1.UpdateServiceRequest
UpdateServiceRequest.Builder
The request message for RegistrationService.UpdateService.
Protobuf type google.cloud.servicedirectory.v1.UpdateServiceRequest