Skip to content

Commit fef053b

Browse files
committed
chore: Clean up the guide
1 parent 5f6b262 commit fef053b

2 files changed

Lines changed: 41 additions & 25 deletions

File tree

docs/endpoint.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Client Library Endpoint
22
Google Client libraries will automatically resolve an endpoint to connect to Google Cloud services.
3-
The default resolved endpoint will be to Google servers (i.e. `https://{serviceName}.googleapis.com:443`).
3+
The default resolved endpoint will be to Google servers (i.e. `https://speech.googleapis.com:443`).
44

55
## Anatomy of an Endpoint
66
Using the default Java-Speech endpoint as an example: `https://speech.googleapis.com:443`:
@@ -9,23 +9,23 @@ Using the default Java-Speech endpoint as an example: `https://speech.googleapis
99
|---------- |-------------- |----------------- |------ |
1010
| https:// | speech | googleapis.com | 443 |
1111

12-
Default values for client libraries:
12+
Default values for Java SDK Client libraries:
1313
- Scheme: https://
1414
- [Universe Domain](universe_domain.md): googleapis.com
1515
- Port: 443
1616

17-
Service Name doesn't have a default value. This is different for each cloud service.
17+
Note: Service Name does not have a default value and is different for each cloud service.
1818

1919
## Configuring a Specific Endpoint
2020
There are two ways to configure the endpoint in Java Client Libraries: ServiceSettings and
2121
TransportChannelProvider.
2222

23-
### Set through the generated {Service}Settings
23+
### (Recommended) Set through the generated {Service}Settings
2424
The following example is using Java-KMS v2.42.0 as an example:
2525

2626
1. Set the endpoint in {Service}Settings.Builder and create the Settings object
2727
```java
28-
String endpoint = "settingsendpoint.com";
28+
String endpoint = "settingsEndpoint.com";
2929
KeyManagementServiceSettings keyManagementServiceSettings =
3030
KeyManagementServiceSettings.newBuilder()
3131
.setEndpoint(endpoint)
@@ -35,17 +35,17 @@ KeyManagementServiceSettings keyManagementServiceSettings =
3535
```java
3636
try (KeyManagementServiceClient keyManagementServiceClient =
3737
KeyManagementServiceClient.create(keyManagementServiceSettings)) {
38+
...
39+
}
3840
```
39-
The endpoint will be resolved to `settingsendpoint.com`.
40-
41-
Note: This is the recommend way to set the endpoint.
41+
The endpoint will be resolved to `settingsEndpoint.com`.
4242

4343
### Set through the Instantiating{Transport}ChannelProvider
4444
The following example is using Java-KMS v2.42.0 as an example:
4545

4646
1. Create the transport specific TransportChannelProvider
4747
```java
48-
String endpoint = "transportendpoint.com";
48+
String endpoint = "transportEndpoint.com";
4949
InstantiatingGrpcChannelProvider instantiatingGrpcChannelProvider =
5050
InstantiatingGrpcChannelProvider.newBuilder()
5151
.setEndpoint(endpoint)
@@ -63,10 +63,12 @@ KeyManagementServiceSettings keyManagementServiceSettings =
6363
```java
6464
try (KeyManagementServiceClient keyManagementServiceClient =
6565
KeyManagementServiceClient.create(keyManagementServiceSettings)) {
66+
...
67+
}
6668
```
67-
The endpoint will be resolved to `transportendpoint.com`.
69+
The endpoint will be resolved to `transportEndpoint.com`.
6870

69-
### Set through both ways
71+
### Set through ServiceSettings and TransportChannelProvider
7072
If you are setting an endpoint via both methods above, like:
7173
```java
7274
String endpoint1 = "transportEndpoint.com";
@@ -83,25 +85,31 @@ KeyManagementServiceSettings keyManagementServiceSettings =
8385
.setTransportChannelProvider(instantiatingGrpcChannelProvider)
8486
.build();
8587
```
86-
The endpoint will be resolved to `transportendpoint.com`.
88+
The endpoint will be resolved to `transportEndpoint.com`.
8789

8890
### Endpoint Hierarchy
8991
1. If set in the TransportChannelProvider, use this value. Otherwise, go to the next step.
9092
2. If set via the ClientSettings, use this value. Otherwise, go to the next step.
9193
3. Use the default endpoint (i.e. `https://{serviceName}.googleapis.com:443`)
9294

93-
### How can I confirm the endpoint the library is using
95+
#### How can I check which endpoint the client library is using
9496
Assuming you have configured a custom endpoint, like:
9597
```java
9698
String endpoint = "...";
9799
KeyManagementServiceSettings keyManagementServiceSettings =
98100
KeyManagementServiceSettings.newBuilder()
99101
.setEndpoint(endpoint)
100102
.build();
103+
try (KeyManagementServiceClient keyManagementServiceClient =
104+
KeyManagementServiceClient.create(keyManagementServiceSettings)) {
105+
...
106+
}
101107
```
102108

103-
You can retrieve the endpoint from the Setting's `getEndpoint()` method. This will return
104-
the resolved endpoint back.
109+
Retrieve the resolved endpoint from the Setting's `getEndpoint()` method
110+
```java
111+
keyManagementServiceClient.getSettings().getEndpoint();
112+
```
105113

106114
## When should I specify my custom endpoint
107115
There are a few use cases:

docs/universe_domain.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ is using Java-KMS v2.42.0 as an example:
1515

1616
1. Set the endpoint in {Service}Settings.Builder and create the Settings object
1717
```java
18-
String universeDomain = "myuniversedomain.com";
18+
String universeDomain = "myUniverseDomain.com";
1919
KeyManagementServiceSettings keyManagementServiceSettings =
2020
KeyManagementServiceSettings.newBuilder()
2121
.setUniverseDomain(universeDomain).build();
@@ -24,26 +24,28 @@ KeyManagementServiceSettings keyManagementServiceSettings =
2424
```java
2525
try (KeyManagementServiceClient keyManagementServiceClient =
2626
KeyManagementServiceClient.create(keyManagementServiceSettings)) {
27+
...
28+
}
2729
```
2830

2931
With this configuration, the client library will resolve the endpoint to be:
30-
`https://cloudkms.myuniversedomain.com:443`.
32+
`https://cloudkms.myUniverseDomain.com:443`.
3133

3234
### Set through an Environment Variable
33-
Set the Universe Domain to the `GOOGLE_CLOUD_UNIVERSE_DOMAIN`. If set, Java client libraries
34-
will read this value and use it.
35+
Set the Universe Domain to the `GOOGLE_CLOUD_UNIVERSE_DOMAIN`. If set, Java client libraries
36+
use this value.
3537

3638
### Universe Domain Hierarchy
3739
1. If set in the ClientSettings, use this value. Otherwise, go to the next step.
3840
2. If set via the Environment Variable, use this value. Otherwise, go to the next step.
39-
3. Use the GDU value
41+
3. Use the GDU value (i.e Universe Domain is set to be `googleapis.com`)
4042

4143
### Configuring a Specific Universe Domain and a Custom Endpoint
4244
The following example is using Java-KMS v2.42.0 as an example:
4345

4446
1. Set the endpoint in {Service}Settings.Builder and create the Settings object
4547
```java
46-
String endpoint = "settingsendpoint.com";
48+
String endpoint = "settingsEndpoint.com:443";
4749
String universeDomain = "universeDomain.com";
4850
KeyManagementServiceSettings keyManagementServiceSettings =
4951
KeyManagementServiceSettings.newBuilder()
@@ -52,10 +54,10 @@ KeyManagementServiceSettings keyManagementServiceSettings =
5254
.build();
5355
```
5456

55-
- The resolved endpoint is: `settingsendpoint.com`
57+
- The resolved endpoint is: `settingsEndpoint.com:443`
5658
- The resolved Universe Domain is: `universeDomain.com`
5759

58-
The custom set endpoint triumphs over other configurations.
60+
The custom set endpoint triumphs over any other configurations.
5961

6062
### How can I confirm the universe domain the library is using
6163
Assuming you have configured a custom endpoint, like:
@@ -65,10 +67,16 @@ KeyManagementServiceSettings keyManagementServiceSettings =
6567
KeyManagementServiceSettings.newBuilder()
6668
.setUniverseDomain(universeDomain)
6769
.build();
70+
try (KeyManagementServiceClient keyManagementServiceClient =
71+
KeyManagementServiceClient.create(keyManagementServiceSettings)) {
72+
...
73+
}
6874
```
6975

70-
You can retrieve the endpoint from the Setting's `getUniverseDomain()` method. This will return
71-
the resolved Universe Domain back.
76+
Retrieve the endpoint from the Setting's `getUniverseDomain()` method.
77+
```java
78+
keyManagementServiceClient.getSettings().getUniverseDomain();
79+
```
7280

7381
## Universe Domain Compatibility with
7482
### ... DirectPath

0 commit comments

Comments
 (0)