From 17d3c800f011c32c46ad090cd73acb19e97fe9fb Mon Sep 17 00:00:00 2001 From: Mahina Kaholokula Date: Tue, 31 Mar 2020 05:43:16 -0400 Subject: [PATCH 1/4] Add java code samples for Service Directory. --- servicedirectory/README.md | 53 +++++++ servicedirectory/java-samples-acct-key.json | 12 ++ servicedirectory/pom.xml | 82 +++++++++++ .../com/example/snippets/EndpointsCreate.java | 71 ++++++++++ .../com/example/snippets/EndpointsDelete.java | 58 ++++++++ .../example/snippets/NamespacesCreate.java | 58 ++++++++ .../example/snippets/NamespacesDelete.java | 54 ++++++++ .../com/example/snippets/ServicesCreate.java | 60 ++++++++ .../com/example/snippets/ServicesDelete.java | 56 ++++++++ .../com/example/snippets/ServicesResolve.java | 68 +++++++++ .../com/example/snippets/EndpointsTests.java | 118 ++++++++++++++++ .../com/example/snippets/NamespacesTests.java | 104 ++++++++++++++ .../com/example/snippets/ServicesTests.java | 129 ++++++++++++++++++ 13 files changed, 923 insertions(+) create mode 100644 servicedirectory/README.md create mode 100644 servicedirectory/java-samples-acct-key.json create mode 100644 servicedirectory/pom.xml create mode 100644 servicedirectory/src/main/java/com/example/snippets/EndpointsCreate.java create mode 100644 servicedirectory/src/main/java/com/example/snippets/EndpointsDelete.java create mode 100644 servicedirectory/src/main/java/com/example/snippets/NamespacesCreate.java create mode 100644 servicedirectory/src/main/java/com/example/snippets/NamespacesDelete.java create mode 100644 servicedirectory/src/main/java/com/example/snippets/ServicesCreate.java create mode 100644 servicedirectory/src/main/java/com/example/snippets/ServicesDelete.java create mode 100644 servicedirectory/src/main/java/com/example/snippets/ServicesResolve.java create mode 100644 servicedirectory/src/test/java/com/example/snippets/EndpointsTests.java create mode 100644 servicedirectory/src/test/java/com/example/snippets/NamespacesTests.java create mode 100644 servicedirectory/src/test/java/com/example/snippets/ServicesTests.java diff --git a/servicedirectory/README.md b/servicedirectory/README.md new file mode 100644 index 00000000000..464ea3fb8f6 --- /dev/null +++ b/servicedirectory/README.md @@ -0,0 +1,53 @@ +# Service Directory + +[Service Directory](https://cloud.google.com/service-directory/) is a platform +for discovering, publishing, and connecting services. It offers customers a +single place to register and discover their services in a consistent and +reliable way, regardless of their environment. These sample Java applications +demonstrate how to access the Service Directory API using the Google Java API +Client Libraries. + +## Prerequisites + +### Enable the API + +You must enable the Service Directory API for your project in order to use these +samples. + +### Set Environment Variables + +You must set your project ID in order to run the tests + +`$export GOOGLE_CLOUD_PROJECT=` + +### Grant Permissions + +You must ensure that the +[user account or service account](https://cloud.google.com/iam/docs/service-accounts#differences_between_a_service_account_and_a_user_account) +you used to authorize your gcloud session has the proper permissions to edit KMS +resources for your project. In the Cloud Console under IAM, add the `Service +Directory Admin` role to the project whose service account you're using to test. + +More information can be found in the +[Authentication docs](https://cloud.google.com/docs/authentication/production). + +## Quickstart + +Install [Maven](http://maven.apache.org/). + +Build your project with: + + mvn clean compile assembly:single + +You can run the quickstart with: + + java -cp target/servicedirectory-samples-1.0-jar-with-dependencies.jar \ + com.example.Quickstart [your-project-id] [your-location] + +You can run the quickstart test with: + + mvn -Dtest='QuickstartTests' test + +You can run all tests with: + + mvn clean verify diff --git a/servicedirectory/java-samples-acct-key.json b/servicedirectory/java-samples-acct-key.json new file mode 100644 index 00000000000..cfb9e9cd257 --- /dev/null +++ b/servicedirectory/java-samples-acct-key.json @@ -0,0 +1,12 @@ +{ + "type": "service_account", + "project_id": "google.com:mkaholok-sd-test", + "private_key_id": "fe517883bfebb452bd761d64ed5a39b760665957", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCvfebdDzWeUGJZ\niVzGOaa3wfqLeRSb2vT7B3AvUe+OaHoVUtI17y9tZq/Uee8AFN0PflM9pS40haeh\nggedWoJeCSu+AM9S7HmsnvZHPXQ8rjkQOv+SlgMlSJoNkY5ndhnn0eMnVOBiZTGu\noAwDNfS3ZD4I9+X9FM12lto8YV/zCD26QkpTko0DOcXmS5buWy3V0PiqodbCb1Ug\nSxONKafOVeI2N98AXBv72jXf5B9luhYRfwD/6iwXzrt/PdXoTYMsIPlrcAEkVjMA\nCoiuhwyj7iZXmOBf2oa5+s3wsbllKLd/T+0Q6sR1ru1FjyBDw/YbFuUEfXJfdvbb\nwMLOo9w1AgMBAAECggEAFvTUR2Se8fe39dh3L2MJQQ559NbA8GZjF5dwgHAqcymN\nls5/uxhvztLY+2V78znHdShkQTMjaTF2rTTyRA478YsnkrJObJ2MiR0+QDF0zB9K\nTao6FnXTMYReypmY1EXpu56EJXf/5j8wkZRUHfNn8LmHN+sdxc571iCDqdRfFc5t\nSaoxcW5+sTi6he778gUwpScbycQSZlCTvSGAcbhMTcR3yKL2Ij0+ogLRFQuBHjI6\nHuia+kMG5E4rtATM5VHzqxSHIYZKwGt19tkfTujROznHbVGIM6/JGmKRUAcN2wAc\nXWNzN3gtx0QxJYe72O1Kn09Ar9rltgE65tRtPdjHYQKBgQDwKCBTVjuSHvhoL5wz\nSkx+sGTv0usFhZKHq4OD7IBtoL6aPIy3nVy2LNlyqDlqd4/2++pMzg/XIq4hyg7h\nHid9tJ9oih0iFsyEmv7mqiDWzDobXVZ3kTTf7tZe8AZ6POmjnGNG++0LGqP3JQ1J\n2X15gy6IvfUyiiDGituDxJr0LQKBgQC7Ea9xpAbb2C3I5UDgZplW9LImf6C3EVr+\njoNAVuleTuSa7TG3GkY7dTJrQCFANj05HoR+Hr3W9pazgI2PG9LMblU3PD0I1lkV\n6gtrT38UmxWzCJBr0RDy9t5ysAhjI2juonWp6BkRyoue+G/hNIVjSHNk7pp6Rk2m\ntr4BqpFlKQKBgQCjoONthKqwA5QDALVvqOb3xt3vHYluSLUu5SiFgWV7zHMxiaHj\nFT/vDB3YZlBAf1hC0x+v1xKp5YI5mX+L2MzVdHTMeJYi/N+6VhTpOu+HCr1oma7p\nZrFdBlFffDEdplUWWd62pb27vBoNsVwdfidk3IGfP7ZKCh0Myd2JKTLevQKBgAXw\npNKF89XNQn7rkKjPeTUCphmE2fSWL35/xfkoCVb+SFIHEBoRUoOW0BgJvESOtFj4\n+BoNHdgSkmx2u4f8yS/GnRwY5JNAQynn+Z7Zsl5UIldCAVv7En+0iRG5Nzr2p+FT\n9UqE3S7scIyGtP7ArS+e4FMnJG6XhuWxTc09vkopAoGALQZRdQlr34sE341+5Zpl\nQbtfeYEd8e6rr03SlhHRngEzTLoH4o6bkCQlFudrIbx/QlDU91uAqplLwcrAqPib\nmz+jzaqauc26CnUSrJGpPhiaY/3Zw2Xaqlx62GRcemycbGdpw5hEO8d2CaTF+Lwh\nr2VEJIq4rjXy5ZfU61UYP+A=\n-----END PRIVATE KEY-----\n", + "client_email": "java-samples-acct@mkaholok-sd-test.google.com.iam.gserviceaccount.com", + "client_id": "109119811390383463303", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/java-samples-acct%40mkaholok-sd-test.google.com.iam.gserviceaccount.com" +} diff --git a/servicedirectory/pom.xml b/servicedirectory/pom.xml new file mode 100644 index 00000000000..335edf15792 --- /dev/null +++ b/servicedirectory/pom.xml @@ -0,0 +1,82 @@ + + 4.0.0 + jar + + com.google.cloud.servicedirectory.samples + servicedirectory-samples + 1.0 + + + + com.google.cloud.samples + shared-configuration + 1.0.13 + + + + 1.8 + 1.8 + UTF-8 + + + + + com.google.cloud + libraries-bom + 4.1.0 + pom + import + + + + + + + com.google.cloud + google-cloud-servicedirectory + 0.1.0 + + + args4j + args4j + 2.33 + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0 + test + + + + + src/main/java + + + org.apache.maven.plugins + maven-compiler-plugin + + + maven-assembly-plugin + + + jar-with-dependencies + + + + + + + diff --git a/servicedirectory/src/main/java/com/example/snippets/EndpointsCreate.java b/servicedirectory/src/main/java/com/example/snippets/EndpointsCreate.java new file mode 100644 index 00000000000..6415996c590 --- /dev/null +++ b/servicedirectory/src/main/java/com/example/snippets/EndpointsCreate.java @@ -0,0 +1,71 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +// [START servicedirectory_create_endpoint] + +import com.google.cloud.servicedirectory.v1beta1.Endpoint; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; +import com.google.cloud.servicedirectory.v1beta1.ServiceName; +import java.io.IOException; + +public class EndpointsCreate { + + public static void createEndpoint() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String locationId = "my-region"; + String namespaceId = "my-namespace"; + String serviceId = "my-service"; + String endpointId = "my-endpoint"; + String address = "10.0.0.1"; + int port = 443; + createEndpoint(projectId, locationId, namespaceId, serviceId, endpointId, address, port); + } + + // Create a new endpoint. + public static void createEndpoint( + String projectId, + String locationId, + String namespaceId, + String serviceId, + String endpointId, + String address, + int port) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (RegistrationServiceClient client = RegistrationServiceClient.create()) { + + // The service to create the endpoint in. + ServiceName parent = ServiceName.of(projectId, locationId, namespaceId, serviceId); + + // The endpoint to create, with fields filled in. + Endpoint endpoint = Endpoint.newBuilder().setAddress(address).setPort(port).build(); + + // Send the request to create the endpoint. + Endpoint createdEndpoint = client.createEndpoint(parent, endpoint, endpointId); + + // Process the response. + System.out.println("Created Endpoint: " + createdEndpoint.getName()); + System.out.println("IP Address: " + createdEndpoint.getAddress()); + System.out.println("Port: " + createdEndpoint.getPort()); + } + } +} +// [END servicedirectory_create_endpoint] diff --git a/servicedirectory/src/main/java/com/example/snippets/EndpointsDelete.java b/servicedirectory/src/main/java/com/example/snippets/EndpointsDelete.java new file mode 100644 index 00000000000..c817c9aee5c --- /dev/null +++ b/servicedirectory/src/main/java/com/example/snippets/EndpointsDelete.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +// [START servicedirectory_delete_endpoint] + +import com.google.cloud.servicedirectory.v1beta1.EndpointName; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; +import java.io.IOException; + +public class EndpointsDelete { + + public static void deleteEndpoint() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String locationId = "my-region"; + String namespaceId = "my-namespace"; + String serviceId = "my-service"; + String endpointId = "my-endpoint"; + deleteEndpoint(projectId, locationId, namespaceId, serviceId, endpointId); + } + + // Delete an endpoint. + public static void deleteEndpoint( + String projectId, String locationId, String namespaceId, String serviceId, String endpointId) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (RegistrationServiceClient client = RegistrationServiceClient.create()) { + + // The endpoint to delete. + EndpointName endpointName = + EndpointName.of(projectId, locationId, namespaceId, serviceId, endpointId); + + // Send the request to delete the endpoint. + client.deleteEndpoint(endpointName); + + // Log the action. + System.out.println("Deleted Endpoint: " + endpointName.toString()); + } + } +} +// [END servicedirectory_delete_endpoint] diff --git a/servicedirectory/src/main/java/com/example/snippets/NamespacesCreate.java b/servicedirectory/src/main/java/com/example/snippets/NamespacesCreate.java new file mode 100644 index 00000000000..04525bb8a8a --- /dev/null +++ b/servicedirectory/src/main/java/com/example/snippets/NamespacesCreate.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +// [START servicedirectory_create_namespace] + +import com.google.cloud.servicedirectory.v1beta1.LocationName; +import com.google.cloud.servicedirectory.v1beta1.Namespace; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; +import java.io.IOException; + +public class NamespacesCreate { + + public static void createNamespace() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String locationId = "my-region"; + String namespaceId = "my-namespace"; + createNamespace(projectId, locationId, namespaceId); + } + + // Create a new namespace. + public static void createNamespace(String projectId, String locationId, String namespaceId) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (RegistrationServiceClient client = RegistrationServiceClient.create()) { + + // The project and location to create the namespace in. + LocationName parent = LocationName.of(projectId, locationId); + + // The namespace object to create. Here, we use the default instance. + Namespace namespace = Namespace.newBuilder().build(); + + // Send the request to create the namespace. + Namespace createdNamespace = client.createNamespace(parent, namespace, namespaceId); + + // Process the response. + System.out.println("Created Namespace: " + createdNamespace.getName()); + } + } +} +// [END servicedirectory_create_namespace] diff --git a/servicedirectory/src/main/java/com/example/snippets/NamespacesDelete.java b/servicedirectory/src/main/java/com/example/snippets/NamespacesDelete.java new file mode 100644 index 00000000000..49debebfee3 --- /dev/null +++ b/servicedirectory/src/main/java/com/example/snippets/NamespacesDelete.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +// [START servicedirectory_delete_namespace] + +import com.google.cloud.servicedirectory.v1beta1.NamespaceName; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; +import java.io.IOException; + +public class NamespacesDelete { + + public static void deleteNamespace() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String locationId = "my-region"; + String namespaceId = "my-namespace"; + deleteNamespace(projectId, locationId, namespaceId); + } + + // Delete a namespace. + public static void deleteNamespace(String projectId, String locationId, String namespaceId) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (RegistrationServiceClient client = RegistrationServiceClient.create()) { + + // The namespace to delete. + NamespaceName namespaceName = NamespaceName.of(projectId, locationId, namespaceId); + + // Send the request to delete the namespace. + client.deleteNamespace(namespaceName); + + // Log the action. + System.out.println("Deleted Namespace: " + namespaceName.toString()); + } + } +} +// [END servicedirectory_delete_namespace] diff --git a/servicedirectory/src/main/java/com/example/snippets/ServicesCreate.java b/servicedirectory/src/main/java/com/example/snippets/ServicesCreate.java new file mode 100644 index 00000000000..fc6f124302a --- /dev/null +++ b/servicedirectory/src/main/java/com/example/snippets/ServicesCreate.java @@ -0,0 +1,60 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +// [START servicedirectory_create_service] + +import com.google.cloud.servicedirectory.v1beta1.NamespaceName; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; +import com.google.cloud.servicedirectory.v1beta1.Service; +import java.io.IOException; + +public class ServicesCreate { + + public static void createService() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String locationId = "my-region"; + String namespaceId = "my-namespace"; + String serviceId = "my-service"; + createService(projectId, locationId, namespaceId, serviceId); + } + + // Create a new service. + public static void createService( + String projectId, String locationId, String namespaceId, String serviceId) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (RegistrationServiceClient client = RegistrationServiceClient.create()) { + + // The namespace to create the service in. + NamespaceName parent = NamespaceName.of(projectId, locationId, namespaceId); + + // The service object to create. Here, we use the default instance. + Service service = Service.newBuilder().build(); + + // Send the request to create the namespace. + Service createdService = client.createService(parent, service, serviceId); + + // Process the response. + System.out.println("Created Service: " + createdService.getName()); + } + } +} +// [END servicedirectory_create_service] diff --git a/servicedirectory/src/main/java/com/example/snippets/ServicesDelete.java b/servicedirectory/src/main/java/com/example/snippets/ServicesDelete.java new file mode 100644 index 00000000000..8429b348abe --- /dev/null +++ b/servicedirectory/src/main/java/com/example/snippets/ServicesDelete.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +// [START servicedirectory_delete_service] + +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; +import com.google.cloud.servicedirectory.v1beta1.ServiceName; +import java.io.IOException; + +public class ServicesDelete { + + public static void deleteService() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String locationId = "my-region"; + String namespaceId = "my-namespace"; + String serviceId = "my-service"; + deleteService(projectId, locationId, namespaceId, serviceId); + } + + // Delete a service. + public static void deleteService( + String projectId, String locationId, String namespaceId, String serviceId) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (RegistrationServiceClient client = RegistrationServiceClient.create()) { + + // The service to delete. + ServiceName serviceName = ServiceName.of(projectId, locationId, namespaceId, serviceId); + + // Send the request to delete the service. + client.deleteService(serviceName); + + // Log the action. + System.out.println("Deleted Service: " + serviceName.toString()); + } + } +} +// [END servicedirectory_delete_service] diff --git a/servicedirectory/src/main/java/com/example/snippets/ServicesResolve.java b/servicedirectory/src/main/java/com/example/snippets/ServicesResolve.java new file mode 100644 index 00000000000..2023d85edba --- /dev/null +++ b/servicedirectory/src/main/java/com/example/snippets/ServicesResolve.java @@ -0,0 +1,68 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +// [START servicedirectory_resolve_service] + +import com.google.cloud.servicedirectory.v1beta1.Endpoint; +import com.google.cloud.servicedirectory.v1beta1.LookupServiceClient; +import com.google.cloud.servicedirectory.v1beta1.ResolveServiceRequest; +import com.google.cloud.servicedirectory.v1beta1.ResolveServiceResponse; +import com.google.cloud.servicedirectory.v1beta1.ServiceName; +import java.io.IOException; + +public class ServicesResolve { + + public static void resolveService() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String locationId = "my-region"; + String namespaceId = "my-namespace"; + String serviceId = "my-service"; + resolveService(projectId, locationId, namespaceId, serviceId); + } + + // Resolve a service. + public static void resolveService( + String projectId, String locationId, String namespaceId, String serviceId) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (LookupServiceClient client = LookupServiceClient.create()) { + // The service to resolve. + ServiceName name = ServiceName.of(projectId, locationId, namespaceId, serviceId); + + // Construct the resolve request to be sent to the client. + ResolveServiceRequest request = + ResolveServiceRequest.newBuilder().setName(name.toString()).build(); + + // Send the request to resolve the service. + ResolveServiceResponse resolveResponse = client.resolveService(request); + + // Process the response. + System.out.println("Resolved Service: " + resolveResponse.getService().getName()); + + System.out.println("Endpoints found:"); + for (Endpoint endpoint : resolveResponse.getService().getEndpointsList()) { + System.out.println( + endpoint.getName() + " -- " + endpoint.getAddress() + ":" + endpoint.getPort()); + } + } + } +} +// [END servicedirectory_resolve_service] diff --git a/servicedirectory/src/test/java/com/example/snippets/EndpointsTests.java b/servicedirectory/src/test/java/com/example/snippets/EndpointsTests.java new file mode 100644 index 00000000000..ab293fbe8cc --- /dev/null +++ b/servicedirectory/src/test/java/com/example/snippets/EndpointsTests.java @@ -0,0 +1,118 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +import com.google.cloud.servicedirectory.v1beta1.EndpointName; +import com.google.cloud.servicedirectory.v1beta1.LocationName; +import com.google.cloud.servicedirectory.v1beta1.Namespace; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient.ListNamespacesPagedResponse; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import org.hamcrest.CoreMatchers; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class EndpointsTests { + + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String LOCATION_ID = "us-central1"; + private static final String NAMESPACE_ID = "namespace-" + UUID.randomUUID().toString(); + private static final String SERVICE_ID = "service-" + UUID.randomUUID().toString(); + private static final String ENDPOINT_ID = "endpoint-" + UUID.randomUUID().toString(); + private static final String ADDRESS = "10.0.0.8"; + private static final int PORT = 443; + + private ByteArrayOutputStream bout; + + private static void requireEnvVar(String varName) { + assertNotNull( + String.format("Environment variable '%s' must be set to perform these tests.", varName), + System.getenv(varName)); + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); + requireEnvVar("GOOGLE_CLOUD_PROJECT"); + } + + @Before + public void setUp() throws Exception { + bout = new ByteArrayOutputStream(); + System.setOut(new PrintStream(bout)); + + // Setup: create a namespace for the endpoints to live in. + NamespacesCreate.createNamespace(PROJECT_ID, LOCATION_ID, NAMESPACE_ID); + + // Setup: create a service for the endpoints to live in. + ServicesCreate.createService(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID); + } + + @After + public void tearDown() throws Exception { + System.setOut(null); + bout.reset(); + + // Deletes all resources created during these tests. + try (RegistrationServiceClient client = RegistrationServiceClient.create()) { + // List the namespaces. + String locationPath = LocationName.format(PROJECT_ID, LOCATION_ID); + ListNamespacesPagedResponse response = client.listNamespaces(locationPath); + + // Delete each namespace. + for (Namespace ns : response.iterateAll()) { + client.deleteNamespace(ns.getName()); + } + } + } + + @Test + public void testCreateEndpoint() throws Exception { + EndpointsCreate.createEndpoint( + PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID, ENDPOINT_ID, ADDRESS, PORT); + String endpointName = + EndpointName.format(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID, ENDPOINT_ID); + String output = bout.toString(); + assertThat( + output, CoreMatchers.containsString(String.format("Created Endpoint: %s", endpointName))); + } + + @Test + public void testDeleteService() throws Exception { + // Setup: create an endpoint. + EndpointsCreate.createEndpoint( + PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID, ENDPOINT_ID, ADDRESS, PORT); + String endpointName = + EndpointName.format(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID, ENDPOINT_ID); + + // Delete the endpoint with the specified ID. + EndpointsDelete.deleteEndpoint(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID, ENDPOINT_ID); + String output = bout.toString(); + assertThat( + output, CoreMatchers.containsString(String.format("Deleted Endpoint: %s", endpointName))); + } +} diff --git a/servicedirectory/src/test/java/com/example/snippets/NamespacesTests.java b/servicedirectory/src/test/java/com/example/snippets/NamespacesTests.java new file mode 100644 index 00000000000..2294f378a41 --- /dev/null +++ b/servicedirectory/src/test/java/com/example/snippets/NamespacesTests.java @@ -0,0 +1,104 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +import com.google.cloud.servicedirectory.v1beta1.LocationName; +import com.google.cloud.servicedirectory.v1beta1.Namespace; +import com.google.cloud.servicedirectory.v1beta1.NamespaceName; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient.ListNamespacesPagedResponse; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import org.hamcrest.CoreMatchers; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class NamespacesTests { + + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String LOCATION_ID = "us-central1"; + private static final String NAMESPACE_ID = "namespace-" + UUID.randomUUID().toString(); + + private ByteArrayOutputStream bout; + + private static void requireEnvVar(String varName) { + assertNotNull( + String.format("Environment variable '%s' must be set to perform these tests.", varName), + System.getenv(varName)); + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); + requireEnvVar("GOOGLE_CLOUD_PROJECT"); + } + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + System.setOut(new PrintStream(bout)); + } + + @After + public void tearDown() throws Exception { + System.setOut(null); + bout.reset(); + + // Deletes any namespaces created during these tests. + try (RegistrationServiceClient client = RegistrationServiceClient.create()) { + // List the namespaces. + String locationPath = LocationName.format(PROJECT_ID, LOCATION_ID); + ListNamespacesPagedResponse response = client.listNamespaces(locationPath); + + // Delete each namespace. + for (Namespace ns : response.iterateAll()) { + client.deleteNamespace(ns.getName()); + } + } + } + + @Test + public void testCreateNamespace() throws Exception { + NamespacesCreate.createNamespace(PROJECT_ID, LOCATION_ID, NAMESPACE_ID); + String namespaceName = NamespaceName.format(PROJECT_ID, LOCATION_ID, NAMESPACE_ID); + String output = bout.toString(); + assertThat( + output, CoreMatchers.containsString(String.format("Created Namespace: %s", namespaceName))); + } + + @Test + public void testDeleteNamespace() throws Exception { + // Setup: create a namespace. + NamespacesCreate.createNamespace(PROJECT_ID, LOCATION_ID, NAMESPACE_ID); + String namespaceName = NamespaceName.format(PROJECT_ID, LOCATION_ID, NAMESPACE_ID); + + // Delete the namespace with the specified ID. + NamespacesDelete.deleteNamespace(PROJECT_ID, LOCATION_ID, NAMESPACE_ID); + String output = bout.toString(); + assertThat( + output, CoreMatchers.containsString(String.format("Deleted Namespace: %s", namespaceName))); + } +} diff --git a/servicedirectory/src/test/java/com/example/snippets/ServicesTests.java b/servicedirectory/src/test/java/com/example/snippets/ServicesTests.java new file mode 100644 index 00000000000..33fdd5307aa --- /dev/null +++ b/servicedirectory/src/test/java/com/example/snippets/ServicesTests.java @@ -0,0 +1,129 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.servicedirectory.snippets; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +import com.google.cloud.servicedirectory.v1beta1.EndpointName; +import com.google.cloud.servicedirectory.v1beta1.LocationName; +import com.google.cloud.servicedirectory.v1beta1.Namespace; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient; +import com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClient.ListNamespacesPagedResponse; +import com.google.cloud.servicedirectory.v1beta1.ServiceName; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import org.hamcrest.CoreMatchers; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class ServicesTests { + + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String LOCATION_ID = "us-central1"; + private static final String NAMESPACE_ID = "namespace-" + UUID.randomUUID().toString(); + private static final String SERVICE_ID = "service-" + UUID.randomUUID().toString(); + + private ByteArrayOutputStream bout; + + private static void requireEnvVar(String varName) { + assertNotNull( + String.format("Environment variable '%s' must be set to perform these tests.", varName), + System.getenv(varName)); + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); + requireEnvVar("GOOGLE_CLOUD_PROJECT"); + } + + @Before + public void setUp() throws Exception { + bout = new ByteArrayOutputStream(); + System.setOut(new PrintStream(bout)); + + // Setup: create a namespace for the services to live in. + NamespacesCreate.createNamespace(PROJECT_ID, LOCATION_ID, NAMESPACE_ID); + } + + @After + public void tearDown() throws Exception { + System.setOut(null); + bout.reset(); + + // Deletes all resources created during these tests. + try (RegistrationServiceClient client = RegistrationServiceClient.create()) { + // List the namespaces. + String locationPath = LocationName.format(PROJECT_ID, LOCATION_ID); + ListNamespacesPagedResponse response = client.listNamespaces(locationPath); + + // Delete each namespace. + for (Namespace ns : response.iterateAll()) { + client.deleteNamespace(ns.getName()); + } + } + } + + @Test + public void testCreateService() throws Exception { + ServicesCreate.createService(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID); + String serviceName = ServiceName.format(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID); + String output = bout.toString(); + assertThat( + output, CoreMatchers.containsString(String.format("Created Service: %s", serviceName))); + } + + @Test + public void testResolveService() throws Exception { + // Setup: create a service. + ServicesCreate.createService(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID); + String serviceName = ServiceName.format(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID); + // Setup: Create an endpoint in the service. + EndpointsCreate.createEndpoint( + PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID, "default-endpoint", "10.0.0.8", 443); + String endpointName = + EndpointName.format(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID, "default-endpoint"); + + // Resolve the service with the specified ID. + ServicesResolve.resolveService(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID); + String output = bout.toString(); + assertThat( + output, CoreMatchers.containsString(String.format("Resolved Service: %s", serviceName))); + assertThat( + output, CoreMatchers.containsString(String.format("Endpoints found:\n%s", endpointName))); + } + + @Test + public void testDeleteService() throws Exception { + // Setup: create a service. + ServicesCreate.createService(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID); + String serviceName = ServiceName.format(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID); + + // Delete the service with the specified ID. + ServicesDelete.deleteService(PROJECT_ID, LOCATION_ID, NAMESPACE_ID, SERVICE_ID); + String output = bout.toString(); + assertThat( + output, CoreMatchers.containsString(String.format("Deleted Service: %s", serviceName))); + } +} From 440c752adaa4148cfba6787b5e1e3066e6fa9222 Mon Sep 17 00:00:00 2001 From: Mahina Kaholokula Date: Tue, 31 Mar 2020 06:26:19 -0400 Subject: [PATCH 2/4] Add code samples for Service Directory. --- servicedirectory/README.md | 9 --------- .../main/java/com/example/snippets/EndpointsCreate.java | 8 ++++---- .../main/java/com/example/snippets/EndpointsDelete.java | 8 ++++---- .../main/java/com/example/snippets/NamespacesCreate.java | 4 ++-- .../main/java/com/example/snippets/NamespacesDelete.java | 4 ++-- .../main/java/com/example/snippets/ServicesCreate.java | 6 +++--- .../main/java/com/example/snippets/ServicesDelete.java | 6 +++--- .../main/java/com/example/snippets/ServicesResolve.java | 6 +++--- 8 files changed, 21 insertions(+), 30 deletions(-) diff --git a/servicedirectory/README.md b/servicedirectory/README.md index 464ea3fb8f6..aea42b77d4d 100644 --- a/servicedirectory/README.md +++ b/servicedirectory/README.md @@ -39,15 +39,6 @@ Build your project with: mvn clean compile assembly:single -You can run the quickstart with: - - java -cp target/servicedirectory-samples-1.0-jar-with-dependencies.jar \ - com.example.Quickstart [your-project-id] [your-location] - -You can run the quickstart test with: - - mvn -Dtest='QuickstartTests' test - You can run all tests with: mvn clean verify diff --git a/servicedirectory/src/main/java/com/example/snippets/EndpointsCreate.java b/servicedirectory/src/main/java/com/example/snippets/EndpointsCreate.java index 6415996c590..ef4adebf712 100644 --- a/servicedirectory/src/main/java/com/example/snippets/EndpointsCreate.java +++ b/servicedirectory/src/main/java/com/example/snippets/EndpointsCreate.java @@ -28,10 +28,10 @@ public class EndpointsCreate { public static void createEndpoint() throws IOException { // TODO(developer): Replace these variables before running the sample. String projectId = "your-project-id"; - String locationId = "my-region"; - String namespaceId = "my-namespace"; - String serviceId = "my-service"; - String endpointId = "my-endpoint"; + String locationId = "your-region"; + String namespaceId = "your-namespace"; + String serviceId = "your-service"; + String endpointId = "your-endpoint"; String address = "10.0.0.1"; int port = 443; createEndpoint(projectId, locationId, namespaceId, serviceId, endpointId, address, port); diff --git a/servicedirectory/src/main/java/com/example/snippets/EndpointsDelete.java b/servicedirectory/src/main/java/com/example/snippets/EndpointsDelete.java index c817c9aee5c..69c5fb072e8 100644 --- a/servicedirectory/src/main/java/com/example/snippets/EndpointsDelete.java +++ b/servicedirectory/src/main/java/com/example/snippets/EndpointsDelete.java @@ -27,10 +27,10 @@ public class EndpointsDelete { public static void deleteEndpoint() throws IOException { // TODO(developer): Replace these variables before running the sample. String projectId = "your-project-id"; - String locationId = "my-region"; - String namespaceId = "my-namespace"; - String serviceId = "my-service"; - String endpointId = "my-endpoint"; + String locationId = "your-region"; + String namespaceId = "your-namespace"; + String serviceId = "your-service"; + String endpointId = "your-endpoint"; deleteEndpoint(projectId, locationId, namespaceId, serviceId, endpointId); } diff --git a/servicedirectory/src/main/java/com/example/snippets/NamespacesCreate.java b/servicedirectory/src/main/java/com/example/snippets/NamespacesCreate.java index 04525bb8a8a..3bf548894dc 100644 --- a/servicedirectory/src/main/java/com/example/snippets/NamespacesCreate.java +++ b/servicedirectory/src/main/java/com/example/snippets/NamespacesCreate.java @@ -28,8 +28,8 @@ public class NamespacesCreate { public static void createNamespace() throws IOException { // TODO(developer): Replace these variables before running the sample. String projectId = "your-project-id"; - String locationId = "my-region"; - String namespaceId = "my-namespace"; + String locationId = "your-region"; + String namespaceId = "your-namespace"; createNamespace(projectId, locationId, namespaceId); } diff --git a/servicedirectory/src/main/java/com/example/snippets/NamespacesDelete.java b/servicedirectory/src/main/java/com/example/snippets/NamespacesDelete.java index 49debebfee3..1428d2a24d9 100644 --- a/servicedirectory/src/main/java/com/example/snippets/NamespacesDelete.java +++ b/servicedirectory/src/main/java/com/example/snippets/NamespacesDelete.java @@ -27,8 +27,8 @@ public class NamespacesDelete { public static void deleteNamespace() throws IOException { // TODO(developer): Replace these variables before running the sample. String projectId = "your-project-id"; - String locationId = "my-region"; - String namespaceId = "my-namespace"; + String locationId = "your-region"; + String namespaceId = "your-namespace"; deleteNamespace(projectId, locationId, namespaceId); } diff --git a/servicedirectory/src/main/java/com/example/snippets/ServicesCreate.java b/servicedirectory/src/main/java/com/example/snippets/ServicesCreate.java index fc6f124302a..c0cb3719a38 100644 --- a/servicedirectory/src/main/java/com/example/snippets/ServicesCreate.java +++ b/servicedirectory/src/main/java/com/example/snippets/ServicesCreate.java @@ -28,9 +28,9 @@ public class ServicesCreate { public static void createService() throws IOException { // TODO(developer): Replace these variables before running the sample. String projectId = "your-project-id"; - String locationId = "my-region"; - String namespaceId = "my-namespace"; - String serviceId = "my-service"; + String locationId = "your-region"; + String namespaceId = "your-namespace"; + String serviceId = "your-service"; createService(projectId, locationId, namespaceId, serviceId); } diff --git a/servicedirectory/src/main/java/com/example/snippets/ServicesDelete.java b/servicedirectory/src/main/java/com/example/snippets/ServicesDelete.java index 8429b348abe..82bd38259b1 100644 --- a/servicedirectory/src/main/java/com/example/snippets/ServicesDelete.java +++ b/servicedirectory/src/main/java/com/example/snippets/ServicesDelete.java @@ -27,9 +27,9 @@ public class ServicesDelete { public static void deleteService() throws IOException { // TODO(developer): Replace these variables before running the sample. String projectId = "your-project-id"; - String locationId = "my-region"; - String namespaceId = "my-namespace"; - String serviceId = "my-service"; + String locationId = "your-region"; + String namespaceId = "your-namespace"; + String serviceId = "your-service"; deleteService(projectId, locationId, namespaceId, serviceId); } diff --git a/servicedirectory/src/main/java/com/example/snippets/ServicesResolve.java b/servicedirectory/src/main/java/com/example/snippets/ServicesResolve.java index 2023d85edba..4215c14d415 100644 --- a/servicedirectory/src/main/java/com/example/snippets/ServicesResolve.java +++ b/servicedirectory/src/main/java/com/example/snippets/ServicesResolve.java @@ -30,9 +30,9 @@ public class ServicesResolve { public static void resolveService() throws IOException { // TODO(developer): Replace these variables before running the sample. String projectId = "your-project-id"; - String locationId = "my-region"; - String namespaceId = "my-namespace"; - String serviceId = "my-service"; + String locationId = "your-region"; + String namespaceId = "your-namespace"; + String serviceId = "your-service"; resolveService(projectId, locationId, namespaceId, serviceId); } From 21828d50de2277f5122beb8c172139b3ec311396 Mon Sep 17 00:00:00 2001 From: Mahina Kaholokula Date: Tue, 31 Mar 2020 06:32:42 -0400 Subject: [PATCH 3/4] Remove service account key json file --- servicedirectory/java-samples-acct-key.json | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 servicedirectory/java-samples-acct-key.json diff --git a/servicedirectory/java-samples-acct-key.json b/servicedirectory/java-samples-acct-key.json deleted file mode 100644 index cfb9e9cd257..00000000000 --- a/servicedirectory/java-samples-acct-key.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "service_account", - "project_id": "google.com:mkaholok-sd-test", - "private_key_id": "fe517883bfebb452bd761d64ed5a39b760665957", - "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCvfebdDzWeUGJZ\niVzGOaa3wfqLeRSb2vT7B3AvUe+OaHoVUtI17y9tZq/Uee8AFN0PflM9pS40haeh\nggedWoJeCSu+AM9S7HmsnvZHPXQ8rjkQOv+SlgMlSJoNkY5ndhnn0eMnVOBiZTGu\noAwDNfS3ZD4I9+X9FM12lto8YV/zCD26QkpTko0DOcXmS5buWy3V0PiqodbCb1Ug\nSxONKafOVeI2N98AXBv72jXf5B9luhYRfwD/6iwXzrt/PdXoTYMsIPlrcAEkVjMA\nCoiuhwyj7iZXmOBf2oa5+s3wsbllKLd/T+0Q6sR1ru1FjyBDw/YbFuUEfXJfdvbb\nwMLOo9w1AgMBAAECggEAFvTUR2Se8fe39dh3L2MJQQ559NbA8GZjF5dwgHAqcymN\nls5/uxhvztLY+2V78znHdShkQTMjaTF2rTTyRA478YsnkrJObJ2MiR0+QDF0zB9K\nTao6FnXTMYReypmY1EXpu56EJXf/5j8wkZRUHfNn8LmHN+sdxc571iCDqdRfFc5t\nSaoxcW5+sTi6he778gUwpScbycQSZlCTvSGAcbhMTcR3yKL2Ij0+ogLRFQuBHjI6\nHuia+kMG5E4rtATM5VHzqxSHIYZKwGt19tkfTujROznHbVGIM6/JGmKRUAcN2wAc\nXWNzN3gtx0QxJYe72O1Kn09Ar9rltgE65tRtPdjHYQKBgQDwKCBTVjuSHvhoL5wz\nSkx+sGTv0usFhZKHq4OD7IBtoL6aPIy3nVy2LNlyqDlqd4/2++pMzg/XIq4hyg7h\nHid9tJ9oih0iFsyEmv7mqiDWzDobXVZ3kTTf7tZe8AZ6POmjnGNG++0LGqP3JQ1J\n2X15gy6IvfUyiiDGituDxJr0LQKBgQC7Ea9xpAbb2C3I5UDgZplW9LImf6C3EVr+\njoNAVuleTuSa7TG3GkY7dTJrQCFANj05HoR+Hr3W9pazgI2PG9LMblU3PD0I1lkV\n6gtrT38UmxWzCJBr0RDy9t5ysAhjI2juonWp6BkRyoue+G/hNIVjSHNk7pp6Rk2m\ntr4BqpFlKQKBgQCjoONthKqwA5QDALVvqOb3xt3vHYluSLUu5SiFgWV7zHMxiaHj\nFT/vDB3YZlBAf1hC0x+v1xKp5YI5mX+L2MzVdHTMeJYi/N+6VhTpOu+HCr1oma7p\nZrFdBlFffDEdplUWWd62pb27vBoNsVwdfidk3IGfP7ZKCh0Myd2JKTLevQKBgAXw\npNKF89XNQn7rkKjPeTUCphmE2fSWL35/xfkoCVb+SFIHEBoRUoOW0BgJvESOtFj4\n+BoNHdgSkmx2u4f8yS/GnRwY5JNAQynn+Z7Zsl5UIldCAVv7En+0iRG5Nzr2p+FT\n9UqE3S7scIyGtP7ArS+e4FMnJG6XhuWxTc09vkopAoGALQZRdQlr34sE341+5Zpl\nQbtfeYEd8e6rr03SlhHRngEzTLoH4o6bkCQlFudrIbx/QlDU91uAqplLwcrAqPib\nmz+jzaqauc26CnUSrJGpPhiaY/3Zw2Xaqlx62GRcemycbGdpw5hEO8d2CaTF+Lwh\nr2VEJIq4rjXy5ZfU61UYP+A=\n-----END PRIVATE KEY-----\n", - "client_email": "java-samples-acct@mkaholok-sd-test.google.com.iam.gserviceaccount.com", - "client_id": "109119811390383463303", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/java-samples-acct%40mkaholok-sd-test.google.com.iam.gserviceaccount.com" -} From 9a0ebc2a1d449c844c08fd1b1136d63428fe1e9e Mon Sep 17 00:00:00 2001 From: Mahina Kaholokula Date: Wed, 1 Apr 2020 07:26:45 -0400 Subject: [PATCH 4/4] Update servicedirectory/pom.xml Co-Authored-By: Noah Negrey --- servicedirectory/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servicedirectory/pom.xml b/servicedirectory/pom.xml index 335edf15792..de1b245337a 100644 --- a/servicedirectory/pom.xml +++ b/servicedirectory/pom.xml @@ -4,7 +4,7 @@ 4.0.0 jar - com.google.cloud.servicedirectory.samples + com.example servicedirectory-samples 1.0