|
18 | 18 |
|
19 | 19 | // [START servicedirectory_create_service]
|
20 | 20 |
|
21 |
| -import com.google.cloud.servicedirectory.v1beta1.NamespaceName; |
22 |
| -import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; |
23 |
| -import com.google.cloud.servicedirectory.v1beta1.Service; |
| 21 | +import com.google.cloud.servicedirectory.v1.NamespaceName; |
| 22 | +import com.google.cloud.servicedirectory.v1.RegistrationServiceClient; |
| 23 | +import com.google.cloud.servicedirectory.v1.Service; |
24 | 24 | import java.io.IOException;
|
25 | 25 |
|
26 | 26 | public class ServicesCreate {
|
@@ -49,15 +49,15 @@ public static void createService(
|
49 | 49 | NamespaceName parent = NamespaceName.of(projectId, locationId, namespaceId);
|
50 | 50 |
|
51 | 51 | // The service object to create.
|
52 |
| - // Optionally add some metadata for the service. |
53 |
| - Service service = Service.newBuilder().putMetadata("protocol", "tcp").build(); |
| 52 | + // Optionally add some annotations for the service. |
| 53 | + Service service = Service.newBuilder().putAnnotations("protocol", "tcp").build(); |
54 | 54 |
|
55 | 55 | // Send the request to create the namespace.
|
56 | 56 | Service createdService = client.createService(parent, service, serviceId);
|
57 | 57 |
|
58 | 58 | // Process the response.
|
59 | 59 | System.out.println("Created Service: " + createdService.getName());
|
60 |
| - System.out.println("Metadata: " + createdService.getMetadata()); |
| 60 | + System.out.println("Annotations: " + createdService.getAnnotations()); |
61 | 61 | }
|
62 | 62 | }
|
63 | 63 | }
|
|
0 commit comments