Skip to content

Commit

Permalink
feat: run the generator – fewer oneOf types, 12/07/2020 (#54)
Browse files Browse the repository at this point in the history
* feat: run the generator – fewer oneOf types, 12/07/2020

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

* fix: use long not string

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
  • Loading branch information
grant committed Dec 14, 2020
1 parent 652b0ac commit 615e3e7
Show file tree
Hide file tree
Showing 33 changed files with 114 additions and 163 deletions.
Expand Up @@ -28,7 +28,7 @@
public class DestinationAttributes {
private String ip;
private Map<String, String> labels;
private NumResponseItems port;
private Long port;
private String principal;
private String regionCode;

Expand All @@ -47,8 +47,8 @@ public class DestinationAttributes {
/**
* The network port of the peer.
*/
public NumResponseItems getPort() { return port; }
public void setPort(NumResponseItems value) { this.port = value; }
public Long getPort() { return port; }
public void setPort(Long value) { this.port = value; }

/**
* The identity of this peer. Similar to `Request.auth.principal`, but
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/com/google/events/cloud/audit/v1/LogEntryData.java
Expand Up @@ -20,10 +20,7 @@
import java.util.Map;

/**
* Generic log entry, used as a wrapper for Cloud Audit Logs in events.
* This is copied from
* https://github.com/googleapis/googleapis/blob/master/google/logging/v2/log_entry.proto
* and adapted appropriately.
* The data within all Cloud Audit Logs log entry events.
*/
public class LogEntryData {
private String insertID;
Expand All @@ -33,7 +30,7 @@ public class LogEntryData {
private ProtoPayload protoPayload;
private OffsetDateTime receiveTimestamp;
private Resource resource;
private NumResponseItems severity;
private Severity severity;
private String spanID;
private OffsetDateTime timestamp;
private String trace;
Expand Down Expand Up @@ -88,8 +85,8 @@ public class LogEntryData {
/**
* The severity of the log entry.
*/
public NumResponseItems getSeverity() { return severity; }
public void setSeverity(NumResponseItems value) { this.severity = value; }
public Severity getSeverity() { return severity; }
public void setSeverity(Severity value) { this.severity = value; }

/**
* The span ID within the trace associated with the log entry, if any.
Expand Down
Expand Up @@ -24,7 +24,7 @@ public class ProtoPayload {
private AuthorizationInfo[] authorizationInfo;
private Metadata metadata;
private String methodName;
private NumResponseItems numResponseItems;
private Long numResponseItems;
private Request request;
private RequestMetadata requestMetadata;
private ResourceLocation resourceLocation;
Expand Down Expand Up @@ -71,8 +71,8 @@ public class ProtoPayload {
* The number of items returned from a List or Query API method,
* if applicable.
*/
public NumResponseItems getNumResponseItems() { return numResponseItems; }
public void setNumResponseItems(NumResponseItems value) { this.numResponseItems = value; }
public Long getNumResponseItems() { return numResponseItems; }
public void setNumResponseItems(Long value) { this.numResponseItems = value; }

/**
* The operation request. This may not include all request parameters,
Expand Down
Expand Up @@ -40,7 +40,7 @@ public class RequestAttributes {
private String query;
private String reason;
private String scheme;
private NumResponseItems size;
private Long size;
private OffsetDateTime time;

/**
Expand Down Expand Up @@ -117,8 +117,8 @@ public class RequestAttributes {
/**
* The HTTP request size in bytes. If unknown, it must be -1.
*/
public NumResponseItems getSize() { return size; }
public void setSize(NumResponseItems value) { this.size = value; }
public Long getSize() { return size; }
public void setSize(Long value) { this.size = value; }

/**
* The timestamp when the `destination` service receives the first byte of
Expand Down
Expand Up @@ -18,7 +18,10 @@

import java.io.IOException;

public class NumResponseItems {
/**
* The severity of the log entry.
*/
public class Severity {
public Long integerValue;
public String stringValue;
}
Expand Up @@ -20,11 +20,7 @@
import java.util.Map;

/**
* Build event data
* Common build format for Google Cloud Platform API operations.
* Copied from
*
* https://github.com/googleapis/googleapis/blob/master/google/devtools/cloudbuild/v1/cloudbuild.proto.
* Build event data for Google Cloud Platform API operations.
*/
public class BuildEventData {
private Artifacts artifacts;
Expand All @@ -43,7 +39,7 @@ public class BuildEventData {
private Source source;
private SourceProvenance sourceProvenance;
private OffsetDateTime startTime;
private Status status;
private BuildEventDataStatus status;
private String statusDetail;
private Step[] steps;
private Map<String, String> substitutions;
Expand Down Expand Up @@ -171,8 +167,8 @@ public class BuildEventData {
/**
* Status of the build.
*/
public Status getStatus() { return status; }
public void setStatus(Status value) { this.status = value; }
public BuildEventDataStatus getStatus() { return status; }
public void setStatus(BuildEventDataStatus value) { this.status = value; }

/**
* Customer-readable message about the current status.
Expand Down
Expand Up @@ -21,7 +21,7 @@
/**
* Status of the build.
*/
public class Status {
public class BuildEventDataStatus {
public Long integerValue;
public StatusEnum enumValue;
}
Expand Up @@ -23,7 +23,7 @@
*/
public class BuildEventDataTimeout {
private Long nanos;
private DiskSizeGBUnion seconds;
private Long seconds;

/**
* Signed fractions of a second at nanosecond resolution of the span
Expand All @@ -41,6 +41,6 @@ public class BuildEventDataTimeout {
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
*/
public DiskSizeGBUnion getSeconds() { return seconds; }
public void setSeconds(DiskSizeGBUnion value) { this.seconds = value; }
public Long getSeconds() { return seconds; }
public void setSeconds(Long value) { this.seconds = value; }
}
Expand Up @@ -20,7 +20,7 @@
* Special options for this build.
*/
public class Options {
private DiskSizeGBUnion diskSizeGB;
private Long diskSizeGB;
private String[] env;
private Logging logging;
private LogStreamingOption logStreamingOption;
Expand All @@ -40,8 +40,8 @@ public class Options {
* requested. At present, the maximum disk size is 1000GB; builds that request
* more than the maximum are rejected with an error.
*/
public DiskSizeGBUnion getDiskSizeGB() { return diskSizeGB; }
public void setDiskSizeGB(DiskSizeGBUnion value) { this.diskSizeGB = value; }
public Long getDiskSizeGB() { return diskSizeGB; }
public void setDiskSizeGB(Long value) { this.diskSizeGB = value; }

/**
* A list of global environment variable definitions that will exist for all
Expand Down
Expand Up @@ -25,7 +25,7 @@
*/
public class QueueTTL {
private Long nanos;
private DiskSizeGBUnion seconds;
private Long seconds;

/**
* Signed fractions of a second at nanosecond resolution of the span
Expand All @@ -43,6 +43,6 @@ public class QueueTTL {
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
*/
public DiskSizeGBUnion getSeconds() { return seconds; }
public void setSeconds(DiskSizeGBUnion value) { this.seconds = value; }
public Long getSeconds() { return seconds; }
public void setSeconds(Long value) { this.seconds = value; }
}
Expand Up @@ -26,7 +26,7 @@
*/
public class ResolvedStorageSourceClass {
private String bucket;
private DiskSizeGBUnion generation;
private Long generation;
private String object;

/**
Expand All @@ -41,8 +41,8 @@ public class ResolvedStorageSourceClass {
* Google Cloud Storage generation for the object. If the generation is
* omitted, the latest generation will be used.
*/
public DiskSizeGBUnion getGeneration() { return generation; }
public void setGeneration(DiskSizeGBUnion value) { this.generation = value; }
public Long getGeneration() { return generation; }
public void setGeneration(Long value) { this.generation = value; }

/**
* Google Cloud Storage object containing the source.
Expand Down
Expand Up @@ -25,7 +25,7 @@ public class Results {
private String[] buildStepImages;
private String[] buildStepOutputs;
private Image[] images;
private DiskSizeGBUnion numArtifacts;
private Long numArtifacts;

/**
* Path to the artifact manifest. Only populated when artifacts are uploaded.
Expand Down Expand Up @@ -66,6 +66,6 @@ public class Results {
/**
* Number of artifacts uploaded. Only populated when artifacts are uploaded.
*/
public DiskSizeGBUnion getNumArtifacts() { return numArtifacts; }
public void setNumArtifacts(DiskSizeGBUnion value) { this.numArtifacts = value; }
public Long getNumArtifacts() { return numArtifacts; }
public void setNumArtifacts(Long value) { this.numArtifacts = value; }
}
6 changes: 3 additions & 3 deletions src/main/java/com/google/events/cloud/cloudbuild/v1/Step.java
Expand Up @@ -28,7 +28,7 @@ public class Step {
private String name;
private PullTiming pullTiming;
private String[] secretEnv;
private DiskSizeGBUnion status;
private StepStatus status;
private StepTimeout timeout;
private StepTiming timing;
private Volume[] volumes;
Expand Down Expand Up @@ -126,8 +126,8 @@ public class Step {
* only updated on build completion; step status is not updated in real-time
* as the build progresses.
*/
public DiskSizeGBUnion getStatus() { return status; }
public void setStatus(DiskSizeGBUnion value) { this.status = value; }
public StepStatus getStatus() { return status; }
public void setStatus(StepStatus value) { this.status = value; }

/**
* Time limit for executing this build step. If not defined, the step has no
Expand Down
Expand Up @@ -18,7 +18,7 @@

import java.io.IOException;

public class DiskSizeGBUnion {
public class StepStatus {
public Long integerValue;
public String stringValue;
}
Expand Up @@ -23,7 +23,7 @@
*/
public class StepTimeout {
private Long nanos;
private DiskSizeGBUnion seconds;
private Long seconds;

/**
* Signed fractions of a second at nanosecond resolution of the span
Expand All @@ -41,6 +41,6 @@ public class StepTimeout {
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
*/
public DiskSizeGBUnion getSeconds() { return seconds; }
public void setSeconds(DiskSizeGBUnion value) { this.seconds = value; }
public Long getSeconds() { return seconds; }
public void setSeconds(Long value) { this.seconds = value; }
}
Expand Up @@ -23,7 +23,7 @@
*/
public class StorageSourceClass {
private String bucket;
private DiskSizeGBUnion generation;
private Long generation;
private String object;

/**
Expand All @@ -38,8 +38,8 @@ public class StorageSourceClass {
* Google Cloud Storage generation for the object. If the generation is
* omitted, the latest generation will be used.
*/
public DiskSizeGBUnion getGeneration() { return generation; }
public void setGeneration(DiskSizeGBUnion value) { this.generation = value; }
public Long getGeneration() { return generation; }
public void setGeneration(Long value) { this.generation = value; }

/**
* Google Cloud Storage object containing the source.
Expand Down
Expand Up @@ -27,9 +27,9 @@ public class MapValueField {
private String bytesValue;
private Double doubleValue;
private GeoPointValue geoPointValue;
private IntegerValueUnion integerValue;
private Long integerValue;
private MapValue mapValue;
private IntegerValueUnion nullValue;
private NullValue nullValue;
private String referenceValue;
private String stringValue;
private OffsetDateTime timestampValue;
Expand Down Expand Up @@ -73,8 +73,8 @@ public class MapValueField {
/**
* An integer value.
*/
public IntegerValueUnion getIntegerValue() { return integerValue; }
public void setIntegerValue(IntegerValueUnion value) { this.integerValue = value; }
public Long getIntegerValue() { return integerValue; }
public void setIntegerValue(Long value) { this.integerValue = value; }

/**
* A map value.
Expand All @@ -85,8 +85,8 @@ public class MapValueField {
/**
* A null value.
*/
public IntegerValueUnion getNullValue() { return nullValue; }
public void setNullValue(IntegerValueUnion value) { this.nullValue = value; }
public NullValue getNullValue() { return nullValue; }
public void setNullValue(NullValue value) { this.nullValue = value; }

/**
* A reference to a document. For example:
Expand Down
Expand Up @@ -18,7 +18,10 @@

import java.io.IOException;

public class IntegerValueUnion {
/**
* A null value.
*/
public class NullValue {
public Long integerValue;
public String stringValue;
}
Expand Up @@ -27,9 +27,9 @@ public class OldValueField {
private String bytesValue;
private Double doubleValue;
private GeoPointValue geoPointValue;
private IntegerValueUnion integerValue;
private Long integerValue;
private MapValue mapValue;
private IntegerValueUnion nullValue;
private NullValue nullValue;
private String referenceValue;
private String stringValue;
private OffsetDateTime timestampValue;
Expand Down Expand Up @@ -73,8 +73,8 @@ public class OldValueField {
/**
* An integer value.
*/
public IntegerValueUnion getIntegerValue() { return integerValue; }
public void setIntegerValue(IntegerValueUnion value) { this.integerValue = value; }
public Long getIntegerValue() { return integerValue; }
public void setIntegerValue(Long value) { this.integerValue = value; }

/**
* A map value.
Expand All @@ -85,8 +85,8 @@ public class OldValueField {
/**
* A null value.
*/
public IntegerValueUnion getNullValue() { return nullValue; }
public void setNullValue(IntegerValueUnion value) { this.nullValue = value; }
public NullValue getNullValue() { return nullValue; }
public void setNullValue(NullValue value) { this.nullValue = value; }

/**
* A reference to a document. For example:
Expand Down

0 comments on commit 615e3e7

Please sign in to comment.