From ebe8c77ebf2b36f34fb7c91a14cecd3dbce9ccc4 Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Fri, 1 Jul 2016 14:24:47 +0200 Subject: [PATCH] Move MonitoredResourceDescriptor to core module --- gcloud-java-core/pom.xml | 5 +++ .../cloud}/MonitoredResourceDescriptor.java | 32 +++++++++---------- .../MonitoredResourceDescriptorTest.java | 6 ++-- 3 files changed, 24 insertions(+), 19 deletions(-) rename {gcloud-java-logging/src/main/java/com/google/cloud/logging => gcloud-java-core/src/main/java/com/google/cloud}/MonitoredResourceDescriptor.java (91%) rename {gcloud-java-logging/src/test/java/com/google/cloud/logging => gcloud-java-core/src/test/java/com/google/cloud}/MonitoredResourceDescriptorTest.java (96%) diff --git a/gcloud-java-core/pom.xml b/gcloud-java-core/pom.xml index cde25fd1d7f0..f195f7900407 100644 --- a/gcloud-java-core/pom.xml +++ b/gcloud-java-core/pom.xml @@ -108,5 +108,10 @@ gax 0.0.13 + + com.google.api.grpc + grpc-core-proto + 0.0.4 + diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/MonitoredResourceDescriptor.java b/gcloud-java-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java similarity index 91% rename from gcloud-java-logging/src/main/java/com/google/cloud/logging/MonitoredResourceDescriptor.java rename to gcloud-java-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java index a65153d68860..d743e1d39629 100644 --- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/MonitoredResourceDescriptor.java +++ b/gcloud-java-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.cloud.logging; +package com.google.cloud; import static com.google.common.base.Preconditions.checkNotNull; @@ -29,23 +29,23 @@ import java.util.Objects; /** - * This class describes the schema of Cloud Logging monitored resources. Monitored resource - * descriptors contain a type name and a set of labels. For example, the monitored resource - * descriptor for Google Compute Engine VM instances has a type of {@code gce_instance} and - * specifies the use of the labels {@code instance_id} and {@code zone} to identify particular VM - * instances. + * This class describes the schema of Cloud monitored resources. Monitored resource descriptors + * contain a type name and a set of labels. For example, the monitored resource descriptor for + * Google Compute Engine VM instances has a type of {@code gce_instance} and specifies the use of + * the labels {@code instance_id} and {@code zone} to identify particular VM instances. */ public class MonitoredResourceDescriptor implements Serializable { private static final long serialVersionUID = -3702077512777687441L; - static final Function - FROM_PB_FUNCTION = - new Function() { - @Override - public MonitoredResourceDescriptor apply(com.google.api.MonitoredResourceDescriptor pb) { - return fromPb(pb); - } - }; + public static final Function FROM_PB_FUNCTION = + new Function() { + @Override + public MonitoredResourceDescriptor apply( + com.google.api.MonitoredResourceDescriptor pb) { + return fromPb(pb); + } + }; private final String type; private final String name; @@ -306,7 +306,7 @@ public String toString() { .toString(); } - com.google.api.MonitoredResourceDescriptor toPb() { + public com.google.api.MonitoredResourceDescriptor toPb() { com.google.api.MonitoredResourceDescriptor.Builder builder = com.google.api.MonitoredResourceDescriptor.newBuilder() .setType(type) @@ -327,7 +327,7 @@ static Builder builder(String type) { return new Builder(type); } - static MonitoredResourceDescriptor fromPb( + public static MonitoredResourceDescriptor fromPb( com.google.api.MonitoredResourceDescriptor descriptorPb) { Builder builder = builder(descriptorPb.getType()); if (descriptorPb.getName() != null && !descriptorPb.getName().equals("")) { diff --git a/gcloud-java-logging/src/test/java/com/google/cloud/logging/MonitoredResourceDescriptorTest.java b/gcloud-java-core/src/test/java/com/google/cloud/MonitoredResourceDescriptorTest.java similarity index 96% rename from gcloud-java-logging/src/test/java/com/google/cloud/logging/MonitoredResourceDescriptorTest.java rename to gcloud-java-core/src/test/java/com/google/cloud/MonitoredResourceDescriptorTest.java index 32f36e4061fc..cab0438e05d8 100644 --- a/gcloud-java-logging/src/test/java/com/google/cloud/logging/MonitoredResourceDescriptorTest.java +++ b/gcloud-java-core/src/test/java/com/google/cloud/MonitoredResourceDescriptorTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.google.cloud.logging; +package com.google.cloud; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import com.google.cloud.logging.MonitoredResourceDescriptor.LabelDescriptor; -import com.google.cloud.logging.MonitoredResourceDescriptor.LabelDescriptor.ValueType; +import com.google.cloud.MonitoredResourceDescriptor.LabelDescriptor; +import com.google.cloud.MonitoredResourceDescriptor.LabelDescriptor.ValueType; import com.google.common.collect.ImmutableList; import org.junit.Test;