Skip to content

Commit

Permalink
Move MonitoredResourceDescriptor to core module
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Jul 1, 2016
1 parent c8be379 commit ebe8c77
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
5 changes: 5 additions & 0 deletions gcloud-java-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,10 @@
<artifactId>gax</artifactId>
<version>0.0.13</version>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-core-proto</artifactId>
<version>0.0.4</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<com.google.api.MonitoredResourceDescriptor, MonitoredResourceDescriptor>
FROM_PB_FUNCTION =
new Function<com.google.api.MonitoredResourceDescriptor, MonitoredResourceDescriptor>() {
@Override
public MonitoredResourceDescriptor apply(com.google.api.MonitoredResourceDescriptor pb) {
return fromPb(pb);
}
};
public static final Function<com.google.api.MonitoredResourceDescriptor,
MonitoredResourceDescriptor> FROM_PB_FUNCTION =
new Function<com.google.api.MonitoredResourceDescriptor, MonitoredResourceDescriptor>() {
@Override
public MonitoredResourceDescriptor apply(
com.google.api.MonitoredResourceDescriptor pb) {
return fromPb(pb);
}
};

private final String type;
private final String name;
Expand Down Expand Up @@ -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)
Expand All @@ -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("")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ebe8c77

Please sign in to comment.