From b04c94db1875c6fb89ae1b678a7a81fffbfbaf0d Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 13:57:49 +0800 Subject: [PATCH 01/12] =?UTF-8?q?feat:=20java=20util=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=20logGroup=20=E5=BA=8F=E5=88=97=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alibabacloud-gateway-sls/util/java/pom.xml | 5 + .../com/aliyun/gateway/sls/util/Client.java | 4 + .../gateway/sls/util/LogGroupSerializer.java | 138 + .../com/aliyun/gateway/sls/util/Logs.java | 4654 +++++++++++++++++ alibabacloud-gateway-sls/util/main.tea | 5 +- 5 files changed, 4805 insertions(+), 1 deletion(-) create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/LogGroupSerializer.java create mode 100644 alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Logs.java diff --git a/alibabacloud-gateway-sls/util/java/pom.xml b/alibabacloud-gateway-sls/util/java/pom.xml index 25fd8c4e..93742da0 100644 --- a/alibabacloud-gateway-sls/util/java/pom.xml +++ b/alibabacloud-gateway-sls/util/java/pom.xml @@ -72,6 +72,11 @@ 4.11 test + + com.google.protobuf + protobuf-java + 2.5.0 + diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java index 07fdade1..75398cc1 100644 --- a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Client.java @@ -49,4 +49,8 @@ public static Boolean isDecompressorAvailable(String compressType) throws Except public static Long bytesLength(byte[] src) throws Exception { return (long) src.length; } + + public static byte[] serializeLogGroupToPB(Object logGroup) throws Exception { + return LogGroupSerializer.serializeLogGroupToPB(logGroup); + } } diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/LogGroupSerializer.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/LogGroupSerializer.java new file mode 100644 index 00000000..96918ccc --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/LogGroupSerializer.java @@ -0,0 +1,138 @@ +package com.aliyun.gateway.sls.util; + +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; + +public class LogGroupSerializer { + @SuppressWarnings("unchecked") + public static byte[] serializeLogGroupToPB(Object logGroup) throws Exception { + if (!(logGroup instanceof HashMap)) { + throw new IllegalArgumentException("Invalid body type " + logGroup.getClass()); + } + + Logs.LogGroup.Builder logs = Logs.LogGroup.newBuilder(); + HashMap body = (HashMap) logGroup; + + String topic = (String) body.get("Topic"); + if (topic != null) { + logs.setTopic(topic); + } + + String source = (String) body.get("Source"); + if (source == null || source.isEmpty()) { + source = getSourceIP(); + } + if (source != null && !source.isEmpty()) { + logs.setSource(source); + } + + serializeLogTags(logs, body); + + serializeLogs(logs, body); + return logs.build().toByteArray(); + } + + @SuppressWarnings("unchecked") + private static void serializeLogs(Logs.LogGroup.Builder logs, HashMap body) { + ArrayList logItems = (ArrayList) body.get("Logs"); + for (Object obj : logItems) { + Logs.Log.Builder logsBuilder = logs.addLogsBuilder(); + HashMap logItem = (HashMap) obj; + logsBuilder.setTime((Integer) logItem.get("Time")); + ArrayList contents = (ArrayList) logItem.get("Contents"); + for (Object content : contents) { + HashMap realContent = (HashMap) content; + Logs.Log.Content.Builder contentBuilder = logsBuilder.addContentsBuilder(); + contentBuilder.setKey(realContent.get("Key")); + contentBuilder.setValue(realContent.get("Value")); + } + Integer nanoTime = (Integer) logItem.get("TimeNs"); + if (nanoTime != null) { + logsBuilder.setTimeNs(nanoTime); + } + } + } + + @SuppressWarnings("unchecked") + private static void serializeLogTags(Logs.LogGroup.Builder logs, HashMap body) { + ArrayList logTags = (ArrayList) body.get("LogTags"); + if (logTags != null) { + for (Object obj : logTags) { + HashMap tag = (HashMap) obj; + Logs.LogTag.Builder tagBuilder = logs.addLogTagsBuilder(); + tagBuilder.setKey(tag.get("Key")); + tagBuilder.setValue(tag.get("Value")); + } + } + } + + + private static volatile String localMachineIP = null; + private static String getSourceIP() { + if (localMachineIP != null) { + return localMachineIP; + } + String ip = getLocalMachineIP(); + synchronized (LogGroupSerializer.class) { + localMachineIP = ip; // it's ok to overwrite + } + return localMachineIP; + } + + private static String getLocalMachineIP() { + try { + Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces(); + while (networkInterfaces.hasMoreElements()) { + NetworkInterface ni = networkInterfaces.nextElement(); + if (!ni.isUp()) { + continue; + } + Enumeration addresses = ni.getInetAddresses(); + while (addresses.hasMoreElements()) { + final InetAddress address = addresses.nextElement(); + if (!address.isLinkLocalAddress() && address.getHostAddress() != null) { + String ipAddress = address.getHostAddress(); + if (ipAddress.equals(CONST_LOCAL_IP)) { + continue; + } + if (isIPV4Addr(ipAddress)) { + return ipAddress; + } + } + } + } + } catch (SocketException ex) { + // swallow it + } catch (Exception ex) { + // swallow it + } + return ""; + } + + private static boolean isIPV4Addr(final String ipAddress) { + if (ipAddress == null || ipAddress.isEmpty()) { + return false; + } + try { + final String[] tokens = ipAddress.split("\\."); + if (tokens.length != 4) { + return false; + } + for (String token : tokens) { + int i = Integer.parseInt(token); + if (i < 0 || i > 255) { + return false; + } + } + return true; + } catch (Exception ex) { + return false; + } + } + + private static final String CONST_LOCAL_IP = "127.0.0.1"; +} diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Logs.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Logs.java new file mode 100644 index 00000000..b46b52cb --- /dev/null +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/Logs.java @@ -0,0 +1,4654 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Logs.proto + +package com.aliyun.gateway.sls.util; + +public final class Logs { + private Logs() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface LogOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required uint32 Time = 1; + /** + * required uint32 Time = 1; + * + *
+         * UNIX Time Format
+         * 
+ */ + boolean hasTime(); + /** + * required uint32 Time = 1; + * + *
+         * UNIX Time Format
+         * 
+ */ + int getTime(); + + // repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + java.util.List + getContentsList(); + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + com.aliyun.gateway.sls.util.Logs.Log.Content getContents(int index); + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + int getContentsCount(); + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + java.util.List + getContentsOrBuilderList(); + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + com.aliyun.gateway.sls.util.Logs.Log.ContentOrBuilder getContentsOrBuilder( + int index); + + // optional fixed32 Time_ns = 4; + /** + * optional fixed32 Time_ns = 4; + */ + boolean hasTimeNs(); + /** + * optional fixed32 Time_ns = 4; + */ + int getTimeNs(); + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.Log} + */ + public static final class Log extends + com.google.protobuf.GeneratedMessage + implements LogOrBuilder { + // Use Log.newBuilder() to construct. + private Log(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private Log(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final Log defaultInstance; + public static Log getDefaultInstance() { + return defaultInstance; + } + + public Log getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Log( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + time_ = input.readUInt32(); + break; + } + case 18: { + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + contents_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + contents_.add(input.readMessage(com.aliyun.gateway.sls.util.Logs.Log.Content.PARSER, extensionRegistry)); + break; + } + case 37: { + bitField0_ |= 0x00000002; + timeNs_ = input.readFixed32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + contents_ = java.util.Collections.unmodifiableList(contents_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.Log.class, com.aliyun.gateway.sls.util.Logs.Log.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Log parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Log(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public interface ContentOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string Key = 1; + /** + * required string Key = 1; + */ + boolean hasKey(); + /** + * required string Key = 1; + */ + java.lang.String getKey(); + /** + * required string Key = 1; + */ + com.google.protobuf.ByteString + getKeyBytes(); + + // required string Value = 2; + /** + * required string Value = 2; + */ + boolean hasValue(); + /** + * required string Value = 2; + */ + java.lang.String getValue(); + /** + * required string Value = 2; + */ + com.google.protobuf.ByteString + getValueBytes(); + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.Log.Content} + */ + public static final class Content extends + com.google.protobuf.GeneratedMessage + implements ContentOrBuilder { + // Use Content.newBuilder() to construct. + private Content(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private Content(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final Content defaultInstance; + public static Content getDefaultInstance() { + return defaultInstance; + } + + public Content getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Content( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + key_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + value_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_Content_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_Content_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.Log.Content.class, com.aliyun.gateway.sls.util.Logs.Log.Content.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Content parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Content(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string Key = 1; + public static final int KEY_FIELD_NUMBER = 1; + private java.lang.Object key_; + /** + * required string Key = 1; + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + key_ = s; + } + return s; + } + } + /** + * required string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string Value = 2; + public static final int VALUE_FIELD_NUMBER = 2; + private java.lang.Object value_; + /** + * required string Value = 2; + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required string Value = 2; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + value_ = s; + } + return s; + } + } + /** + * required string Value = 2; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + key_ = ""; + value_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasKey()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasValue()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getKeyBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getValueBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getKeyBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getValueBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.Log.Content parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.aliyun.gateway.sls.util.Logs.Log.Content prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.Log.Content} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.aliyun.gateway.sls.util.Logs.Log.ContentOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_Content_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_Content_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.Log.Content.class, com.aliyun.gateway.sls.util.Logs.Log.Content.Builder.class); + } + + // Construct using com.aliyun.gateway.sls.util.Logs.Log.Content.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + key_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + value_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_Content_descriptor; + } + + public com.aliyun.gateway.sls.util.Logs.Log.Content getDefaultInstanceForType() { + return com.aliyun.gateway.sls.util.Logs.Log.Content.getDefaultInstance(); + } + + public com.aliyun.gateway.sls.util.Logs.Log.Content build() { + com.aliyun.gateway.sls.util.Logs.Log.Content result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.aliyun.gateway.sls.util.Logs.Log.Content buildPartial() { + com.aliyun.gateway.sls.util.Logs.Log.Content result = new com.aliyun.gateway.sls.util.Logs.Log.Content(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.key_ = key_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.value_ = value_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.aliyun.gateway.sls.util.Logs.Log.Content) { + return mergeFrom((com.aliyun.gateway.sls.util.Logs.Log.Content)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.aliyun.gateway.sls.util.Logs.Log.Content other) { + if (other == com.aliyun.gateway.sls.util.Logs.Log.Content.getDefaultInstance()) return this; + if (other.hasKey()) { + bitField0_ |= 0x00000001; + key_ = other.key_; + onChanged(); + } + if (other.hasValue()) { + bitField0_ |= 0x00000002; + value_ = other.value_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasKey()) { + + return false; + } + if (!hasValue()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.aliyun.gateway.sls.util.Logs.Log.Content parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.aliyun.gateway.sls.util.Logs.Log.Content) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required string Key = 1; + private java.lang.Object key_ = ""; + /** + * required string Key = 1; + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string Key = 1; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + key_ = value; + onChanged(); + return this; + } + /** + * required string Key = 1; + */ + public Builder clearKey() { + bitField0_ = (bitField0_ & ~0x00000001); + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * required string Key = 1; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + key_ = value; + onChanged(); + return this; + } + + // required string Value = 2; + private java.lang.Object value_ = ""; + /** + * required string Value = 2; + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required string Value = 2; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + value_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string Value = 2; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string Value = 2; + */ + public Builder setValue( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + value_ = value; + onChanged(); + return this; + } + /** + * required string Value = 2; + */ + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000002); + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * required string Value = 2; + */ + public Builder setValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + value_ = value; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.aliyun.gateway.sls.util.Log.Content) + } + + static { + defaultInstance = new Content(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.aliyun.gateway.sls.util.Log.Content) + } + + private int bitField0_; + // required uint32 Time = 1; + public static final int TIME_FIELD_NUMBER = 1; + private int time_; + /** + * required uint32 Time = 1; + * + *
+         * UNIX Time Format
+         * 
+ */ + public boolean hasTime() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required uint32 Time = 1; + * + *
+         * UNIX Time Format
+         * 
+ */ + public int getTime() { + return time_; + } + + // repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + public static final int CONTENTS_FIELD_NUMBER = 2; + private java.util.List contents_; + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public java.util.List getContentsList() { + return contents_; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public java.util.List + getContentsOrBuilderList() { + return contents_; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public int getContentsCount() { + return contents_.size(); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public com.aliyun.gateway.sls.util.Logs.Log.Content getContents(int index) { + return contents_.get(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public com.aliyun.gateway.sls.util.Logs.Log.ContentOrBuilder getContentsOrBuilder( + int index) { + return contents_.get(index); + } + + // optional fixed32 Time_ns = 4; + public static final int TIME_NS_FIELD_NUMBER = 4; + private int timeNs_; + /** + * optional fixed32 Time_ns = 4; + */ + public boolean hasTimeNs() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional fixed32 Time_ns = 4; + */ + public int getTimeNs() { + return timeNs_; + } + + private void initFields() { + time_ = 0; + contents_ = java.util.Collections.emptyList(); + timeNs_ = 0; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTime()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getContentsCount(); i++) { + if (!getContents(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeUInt32(1, time_); + } + for (int i = 0; i < contents_.size(); i++) { + output.writeMessage(2, contents_.get(i)); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeFixed32(4, timeNs_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, time_); + } + for (int i = 0; i < contents_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, contents_.get(i)); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeFixed32Size(4, timeNs_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.aliyun.gateway.sls.util.Logs.Log parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.Log parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.Log parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.Log parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.Log parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.Log parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.Log parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.Log parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.Log parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.Log parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.aliyun.gateway.sls.util.Logs.Log prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.Log} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.aliyun.gateway.sls.util.Logs.LogOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.Log.class, com.aliyun.gateway.sls.util.Logs.Log.Builder.class); + } + + // Construct using com.aliyun.gateway.sls.util.Logs.Log.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getContentsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + time_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + if (contentsBuilder_ == null) { + contents_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + contentsBuilder_.clear(); + } + timeNs_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_Log_descriptor; + } + + public com.aliyun.gateway.sls.util.Logs.Log getDefaultInstanceForType() { + return com.aliyun.gateway.sls.util.Logs.Log.getDefaultInstance(); + } + + public com.aliyun.gateway.sls.util.Logs.Log build() { + com.aliyun.gateway.sls.util.Logs.Log result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.aliyun.gateway.sls.util.Logs.Log buildPartial() { + com.aliyun.gateway.sls.util.Logs.Log result = new com.aliyun.gateway.sls.util.Logs.Log(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.time_ = time_; + if (contentsBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + contents_ = java.util.Collections.unmodifiableList(contents_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.contents_ = contents_; + } else { + result.contents_ = contentsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000002; + } + result.timeNs_ = timeNs_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.aliyun.gateway.sls.util.Logs.Log) { + return mergeFrom((com.aliyun.gateway.sls.util.Logs.Log)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.aliyun.gateway.sls.util.Logs.Log other) { + if (other == com.aliyun.gateway.sls.util.Logs.Log.getDefaultInstance()) return this; + if (other.hasTime()) { + setTime(other.getTime()); + } + if (contentsBuilder_ == null) { + if (!other.contents_.isEmpty()) { + if (contents_.isEmpty()) { + contents_ = other.contents_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureContentsIsMutable(); + contents_.addAll(other.contents_); + } + onChanged(); + } + } else { + if (!other.contents_.isEmpty()) { + if (contentsBuilder_.isEmpty()) { + contentsBuilder_.dispose(); + contentsBuilder_ = null; + contents_ = other.contents_; + bitField0_ = (bitField0_ & ~0x00000002); + contentsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getContentsFieldBuilder() : null; + } else { + contentsBuilder_.addAllMessages(other.contents_); + } + } + } + if (other.hasTimeNs()) { + setTimeNs(other.getTimeNs()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTime()) { + + return false; + } + for (int i = 0; i < getContentsCount(); i++) { + if (!getContents(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.aliyun.gateway.sls.util.Logs.Log parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.aliyun.gateway.sls.util.Logs.Log) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required uint32 Time = 1; + private int time_ ; + /** + * required uint32 Time = 1; + * + *
+             * UNIX Time Format
+             * 
+ */ + public boolean hasTime() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required uint32 Time = 1; + * + *
+             * UNIX Time Format
+             * 
+ */ + public int getTime() { + return time_; + } + /** + * required uint32 Time = 1; + * + *
+             * UNIX Time Format
+             * 
+ */ + public Builder setTime(int value) { + bitField0_ |= 0x00000001; + time_ = value; + onChanged(); + return this; + } + /** + * required uint32 Time = 1; + * + *
+             * UNIX Time Format
+             * 
+ */ + public Builder clearTime() { + bitField0_ = (bitField0_ & ~0x00000001); + time_ = 0; + onChanged(); + return this; + } + + // repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + private java.util.List contents_ = + java.util.Collections.emptyList(); + private void ensureContentsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + contents_ = new java.util.ArrayList(contents_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.Log.Content, com.aliyun.gateway.sls.util.Logs.Log.Content.Builder, com.aliyun.gateway.sls.util.Logs.Log.ContentOrBuilder> contentsBuilder_; + + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public java.util.List getContentsList() { + if (contentsBuilder_ == null) { + return java.util.Collections.unmodifiableList(contents_); + } else { + return contentsBuilder_.getMessageList(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public int getContentsCount() { + if (contentsBuilder_ == null) { + return contents_.size(); + } else { + return contentsBuilder_.getCount(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public com.aliyun.gateway.sls.util.Logs.Log.Content getContents(int index) { + if (contentsBuilder_ == null) { + return contents_.get(index); + } else { + return contentsBuilder_.getMessage(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public Builder setContents( + int index, com.aliyun.gateway.sls.util.Logs.Log.Content value) { + if (contentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentsIsMutable(); + contents_.set(index, value); + onChanged(); + } else { + contentsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public Builder setContents( + int index, com.aliyun.gateway.sls.util.Logs.Log.Content.Builder builderForValue) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + contents_.set(index, builderForValue.build()); + onChanged(); + } else { + contentsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public Builder addContents(com.aliyun.gateway.sls.util.Logs.Log.Content value) { + if (contentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentsIsMutable(); + contents_.add(value); + onChanged(); + } else { + contentsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public Builder addContents( + int index, com.aliyun.gateway.sls.util.Logs.Log.Content value) { + if (contentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentsIsMutable(); + contents_.add(index, value); + onChanged(); + } else { + contentsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public Builder addContents( + com.aliyun.gateway.sls.util.Logs.Log.Content.Builder builderForValue) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + contents_.add(builderForValue.build()); + onChanged(); + } else { + contentsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public Builder addContents( + int index, com.aliyun.gateway.sls.util.Logs.Log.Content.Builder builderForValue) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + contents_.add(index, builderForValue.build()); + onChanged(); + } else { + contentsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public Builder addAllContents( + java.lang.Iterable values) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + super.addAll(values, contents_); + onChanged(); + } else { + contentsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public Builder clearContents() { + if (contentsBuilder_ == null) { + contents_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + contentsBuilder_.clear(); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public Builder removeContents(int index) { + if (contentsBuilder_ == null) { + ensureContentsIsMutable(); + contents_.remove(index); + onChanged(); + } else { + contentsBuilder_.remove(index); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public com.aliyun.gateway.sls.util.Logs.Log.Content.Builder getContentsBuilder( + int index) { + return getContentsFieldBuilder().getBuilder(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public com.aliyun.gateway.sls.util.Logs.Log.ContentOrBuilder getContentsOrBuilder( + int index) { + if (contentsBuilder_ == null) { + return contents_.get(index); } else { + return contentsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public java.util.List + getContentsOrBuilderList() { + if (contentsBuilder_ != null) { + return contentsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(contents_); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public com.aliyun.gateway.sls.util.Logs.Log.Content.Builder addContentsBuilder() { + return getContentsFieldBuilder().addBuilder( + com.aliyun.gateway.sls.util.Logs.Log.Content.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public com.aliyun.gateway.sls.util.Logs.Log.Content.Builder addContentsBuilder( + int index) { + return getContentsFieldBuilder().addBuilder( + index, com.aliyun.gateway.sls.util.Logs.Log.Content.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log.Content Contents = 2; + */ + public java.util.List + getContentsBuilderList() { + return getContentsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.Log.Content, com.aliyun.gateway.sls.util.Logs.Log.Content.Builder, com.aliyun.gateway.sls.util.Logs.Log.ContentOrBuilder> + getContentsFieldBuilder() { + if (contentsBuilder_ == null) { + contentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.Log.Content, com.aliyun.gateway.sls.util.Logs.Log.Content.Builder, com.aliyun.gateway.sls.util.Logs.Log.ContentOrBuilder>( + contents_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + contents_ = null; + } + return contentsBuilder_; + } + + // optional fixed32 Time_ns = 4; + private int timeNs_ ; + /** + * optional fixed32 Time_ns = 4; + */ + public boolean hasTimeNs() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional fixed32 Time_ns = 4; + */ + public int getTimeNs() { + return timeNs_; + } + /** + * optional fixed32 Time_ns = 4; + */ + public Builder setTimeNs(int value) { + bitField0_ |= 0x00000004; + timeNs_ = value; + onChanged(); + return this; + } + /** + * optional fixed32 Time_ns = 4; + */ + public Builder clearTimeNs() { + bitField0_ = (bitField0_ & ~0x00000004); + timeNs_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.aliyun.gateway.sls.util.Log) + } + + static { + defaultInstance = new Log(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.aliyun.gateway.sls.util.Log) + } + + public interface LogTagOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string Key = 1; + /** + * required string Key = 1; + */ + boolean hasKey(); + /** + * required string Key = 1; + */ + java.lang.String getKey(); + /** + * required string Key = 1; + */ + com.google.protobuf.ByteString + getKeyBytes(); + + // required string Value = 2; + /** + * required string Value = 2; + */ + boolean hasValue(); + /** + * required string Value = 2; + */ + java.lang.String getValue(); + /** + * required string Value = 2; + */ + com.google.protobuf.ByteString + getValueBytes(); + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.LogTag} + */ + public static final class LogTag extends + com.google.protobuf.GeneratedMessage + implements LogTagOrBuilder { + // Use LogTag.newBuilder() to construct. + private LogTag(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private LogTag(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final LogTag defaultInstance; + public static LogTag getDefaultInstance() { + return defaultInstance; + } + + public LogTag getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private LogTag( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + key_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + value_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogTag_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogTag_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.LogTag.class, com.aliyun.gateway.sls.util.Logs.LogTag.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public LogTag parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LogTag(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string Key = 1; + public static final int KEY_FIELD_NUMBER = 1; + private java.lang.Object key_; + /** + * required string Key = 1; + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + key_ = s; + } + return s; + } + } + /** + * required string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string Value = 2; + public static final int VALUE_FIELD_NUMBER = 2; + private java.lang.Object value_; + /** + * required string Value = 2; + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required string Value = 2; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + value_ = s; + } + return s; + } + } + /** + * required string Value = 2; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + key_ = ""; + value_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasKey()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasValue()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getKeyBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getValueBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getKeyBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getValueBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.aliyun.gateway.sls.util.Logs.LogTag parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.LogTag parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogTag parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.LogTag parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogTag parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.LogTag parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogTag parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.LogTag parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogTag parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.LogTag parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.aliyun.gateway.sls.util.Logs.LogTag prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.LogTag} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.aliyun.gateway.sls.util.Logs.LogTagOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogTag_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogTag_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.LogTag.class, com.aliyun.gateway.sls.util.Logs.LogTag.Builder.class); + } + + // Construct using com.aliyun.gateway.sls.util.Logs.LogTag.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + key_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + value_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogTag_descriptor; + } + + public com.aliyun.gateway.sls.util.Logs.LogTag getDefaultInstanceForType() { + return com.aliyun.gateway.sls.util.Logs.LogTag.getDefaultInstance(); + } + + public com.aliyun.gateway.sls.util.Logs.LogTag build() { + com.aliyun.gateway.sls.util.Logs.LogTag result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.aliyun.gateway.sls.util.Logs.LogTag buildPartial() { + com.aliyun.gateway.sls.util.Logs.LogTag result = new com.aliyun.gateway.sls.util.Logs.LogTag(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.key_ = key_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.value_ = value_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.aliyun.gateway.sls.util.Logs.LogTag) { + return mergeFrom((com.aliyun.gateway.sls.util.Logs.LogTag)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.aliyun.gateway.sls.util.Logs.LogTag other) { + if (other == com.aliyun.gateway.sls.util.Logs.LogTag.getDefaultInstance()) return this; + if (other.hasKey()) { + bitField0_ |= 0x00000001; + key_ = other.key_; + onChanged(); + } + if (other.hasValue()) { + bitField0_ |= 0x00000002; + value_ = other.value_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasKey()) { + + return false; + } + if (!hasValue()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.aliyun.gateway.sls.util.Logs.LogTag parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.aliyun.gateway.sls.util.Logs.LogTag) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required string Key = 1; + private java.lang.Object key_ = ""; + /** + * required string Key = 1; + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string Key = 1; + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string Key = 1; + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string Key = 1; + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + key_ = value; + onChanged(); + return this; + } + /** + * required string Key = 1; + */ + public Builder clearKey() { + bitField0_ = (bitField0_ & ~0x00000001); + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * required string Key = 1; + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + key_ = value; + onChanged(); + return this; + } + + // required string Value = 2; + private java.lang.Object value_ = ""; + /** + * required string Value = 2; + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required string Value = 2; + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + value_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string Value = 2; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string Value = 2; + */ + public Builder setValue( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + value_ = value; + onChanged(); + return this; + } + /** + * required string Value = 2; + */ + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000002); + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * required string Value = 2; + */ + public Builder setValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + value_ = value; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.aliyun.gateway.sls.util.LogTag) + } + + static { + defaultInstance = new LogTag(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.aliyun.gateway.sls.util.LogTag) + } + + public interface LogGroupOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + java.util.List + getLogsList(); + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + com.aliyun.gateway.sls.util.Logs.Log getLogs(int index); + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + int getLogsCount(); + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + java.util.List + getLogsOrBuilderList(); + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + com.aliyun.gateway.sls.util.Logs.LogOrBuilder getLogsOrBuilder( + int index); + + // optional string Category = 2; + /** + * optional string Category = 2; + */ + boolean hasCategory(); + /** + * optional string Category = 2; + */ + java.lang.String getCategory(); + /** + * optional string Category = 2; + */ + com.google.protobuf.ByteString + getCategoryBytes(); + + // optional string Topic = 3; + /** + * optional string Topic = 3; + */ + boolean hasTopic(); + /** + * optional string Topic = 3; + */ + java.lang.String getTopic(); + /** + * optional string Topic = 3; + */ + com.google.protobuf.ByteString + getTopicBytes(); + + // optional string Source = 4; + /** + * optional string Source = 4; + */ + boolean hasSource(); + /** + * optional string Source = 4; + */ + java.lang.String getSource(); + /** + * optional string Source = 4; + */ + com.google.protobuf.ByteString + getSourceBytes(); + + // optional string MachineUUID = 5; + /** + * optional string MachineUUID = 5; + */ + boolean hasMachineUUID(); + /** + * optional string MachineUUID = 5; + */ + java.lang.String getMachineUUID(); + /** + * optional string MachineUUID = 5; + */ + com.google.protobuf.ByteString + getMachineUUIDBytes(); + + // repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + java.util.List + getLogTagsList(); + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + com.aliyun.gateway.sls.util.Logs.LogTag getLogTags(int index); + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + int getLogTagsCount(); + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + java.util.List + getLogTagsOrBuilderList(); + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + com.aliyun.gateway.sls.util.Logs.LogTagOrBuilder getLogTagsOrBuilder( + int index); + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.LogGroup} + */ + public static final class LogGroup extends + com.google.protobuf.GeneratedMessage + implements LogGroupOrBuilder { + // Use LogGroup.newBuilder() to construct. + private LogGroup(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private LogGroup(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final LogGroup defaultInstance; + public static LogGroup getDefaultInstance() { + return defaultInstance; + } + + public LogGroup getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private LogGroup( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + logs_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + logs_.add(input.readMessage(com.aliyun.gateway.sls.util.Logs.Log.PARSER, extensionRegistry)); + break; + } + case 18: { + bitField0_ |= 0x00000001; + category_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000002; + topic_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000004; + source_ = input.readBytes(); + break; + } + case 42: { + bitField0_ |= 0x00000008; + machineUUID_ = input.readBytes(); + break; + } + case 50: { + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + logTags_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + logTags_.add(input.readMessage(com.aliyun.gateway.sls.util.Logs.LogTag.PARSER, extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + logs_ = java.util.Collections.unmodifiableList(logs_); + } + if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + logTags_ = java.util.Collections.unmodifiableList(logTags_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroup_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroup_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.LogGroup.class, com.aliyun.gateway.sls.util.Logs.LogGroup.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public LogGroup parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LogGroup(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + public static final int LOGS_FIELD_NUMBER = 1; + private java.util.List logs_; + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public java.util.List getLogsList() { + return logs_; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public java.util.List + getLogsOrBuilderList() { + return logs_; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public int getLogsCount() { + return logs_.size(); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.Logs.Log getLogs(int index) { + return logs_.get(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.Logs.LogOrBuilder getLogsOrBuilder( + int index) { + return logs_.get(index); + } + + // optional string Category = 2; + public static final int CATEGORY_FIELD_NUMBER = 2; + private java.lang.Object category_; + /** + * optional string Category = 2; + */ + public boolean hasCategory() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional string Category = 2; + */ + public java.lang.String getCategory() { + java.lang.Object ref = category_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + category_ = s; + } + return s; + } + } + /** + * optional string Category = 2; + */ + public com.google.protobuf.ByteString + getCategoryBytes() { + java.lang.Object ref = category_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + category_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string Topic = 3; + public static final int TOPIC_FIELD_NUMBER = 3; + private java.lang.Object topic_; + /** + * optional string Topic = 3; + */ + public boolean hasTopic() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string Topic = 3; + */ + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + topic_ = s; + } + return s; + } + } + /** + * optional string Topic = 3; + */ + public com.google.protobuf.ByteString + getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string Source = 4; + public static final int SOURCE_FIELD_NUMBER = 4; + private java.lang.Object source_; + /** + * optional string Source = 4; + */ + public boolean hasSource() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string Source = 4; + */ + public java.lang.String getSource() { + java.lang.Object ref = source_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + source_ = s; + } + return s; + } + } + /** + * optional string Source = 4; + */ + public com.google.protobuf.ByteString + getSourceBytes() { + java.lang.Object ref = source_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + source_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string MachineUUID = 5; + public static final int MACHINEUUID_FIELD_NUMBER = 5; + private java.lang.Object machineUUID_; + /** + * optional string MachineUUID = 5; + */ + public boolean hasMachineUUID() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional string MachineUUID = 5; + */ + public java.lang.String getMachineUUID() { + java.lang.Object ref = machineUUID_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + machineUUID_ = s; + } + return s; + } + } + /** + * optional string MachineUUID = 5; + */ + public com.google.protobuf.ByteString + getMachineUUIDBytes() { + java.lang.Object ref = machineUUID_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + machineUUID_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + public static final int LOGTAGS_FIELD_NUMBER = 6; + private java.util.List logTags_; + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public java.util.List getLogTagsList() { + return logTags_; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public java.util.List + getLogTagsOrBuilderList() { + return logTags_; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public int getLogTagsCount() { + return logTags_.size(); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.Logs.LogTag getLogTags(int index) { + return logTags_.get(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.Logs.LogTagOrBuilder getLogTagsOrBuilder( + int index) { + return logTags_.get(index); + } + + private void initFields() { + logs_ = java.util.Collections.emptyList(); + category_ = ""; + topic_ = ""; + source_ = ""; + machineUUID_ = ""; + logTags_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getLogsCount(); i++) { + if (!getLogs(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getLogTagsCount(); i++) { + if (!getLogTags(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < logs_.size(); i++) { + output.writeMessage(1, logs_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(2, getCategoryBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(3, getTopicBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(4, getSourceBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(5, getMachineUUIDBytes()); + } + for (int i = 0; i < logTags_.size(); i++) { + output.writeMessage(6, logTags_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < logs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, logs_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getCategoryBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTopicBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getSourceBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, getMachineUUIDBytes()); + } + for (int i = 0; i < logTags_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, logTags_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroup parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.aliyun.gateway.sls.util.Logs.LogGroup prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.LogGroup} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.aliyun.gateway.sls.util.Logs.LogGroupOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroup_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroup_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.LogGroup.class, com.aliyun.gateway.sls.util.Logs.LogGroup.Builder.class); + } + + // Construct using com.aliyun.gateway.sls.util.Logs.LogGroup.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getLogsFieldBuilder(); + getLogTagsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (logsBuilder_ == null) { + logs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + logsBuilder_.clear(); + } + category_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + topic_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + source_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + machineUUID_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); + if (logTagsBuilder_ == null) { + logTags_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + } else { + logTagsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroup_descriptor; + } + + public com.aliyun.gateway.sls.util.Logs.LogGroup getDefaultInstanceForType() { + return com.aliyun.gateway.sls.util.Logs.LogGroup.getDefaultInstance(); + } + + public com.aliyun.gateway.sls.util.Logs.LogGroup build() { + com.aliyun.gateway.sls.util.Logs.LogGroup result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.aliyun.gateway.sls.util.Logs.LogGroup buildPartial() { + com.aliyun.gateway.sls.util.Logs.LogGroup result = new com.aliyun.gateway.sls.util.Logs.LogGroup(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (logsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + logs_ = java.util.Collections.unmodifiableList(logs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.logs_ = logs_; + } else { + result.logs_ = logsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000001; + } + result.category_ = category_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000002; + } + result.topic_ = topic_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000004; + } + result.source_ = source_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000008; + } + result.machineUUID_ = machineUUID_; + if (logTagsBuilder_ == null) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { + logTags_ = java.util.Collections.unmodifiableList(logTags_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.logTags_ = logTags_; + } else { + result.logTags_ = logTagsBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.aliyun.gateway.sls.util.Logs.LogGroup) { + return mergeFrom((com.aliyun.gateway.sls.util.Logs.LogGroup)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.aliyun.gateway.sls.util.Logs.LogGroup other) { + if (other == com.aliyun.gateway.sls.util.Logs.LogGroup.getDefaultInstance()) return this; + if (logsBuilder_ == null) { + if (!other.logs_.isEmpty()) { + if (logs_.isEmpty()) { + logs_ = other.logs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLogsIsMutable(); + logs_.addAll(other.logs_); + } + onChanged(); + } + } else { + if (!other.logs_.isEmpty()) { + if (logsBuilder_.isEmpty()) { + logsBuilder_.dispose(); + logsBuilder_ = null; + logs_ = other.logs_; + bitField0_ = (bitField0_ & ~0x00000001); + logsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getLogsFieldBuilder() : null; + } else { + logsBuilder_.addAllMessages(other.logs_); + } + } + } + if (other.hasCategory()) { + bitField0_ |= 0x00000002; + category_ = other.category_; + onChanged(); + } + if (other.hasTopic()) { + bitField0_ |= 0x00000004; + topic_ = other.topic_; + onChanged(); + } + if (other.hasSource()) { + bitField0_ |= 0x00000008; + source_ = other.source_; + onChanged(); + } + if (other.hasMachineUUID()) { + bitField0_ |= 0x00000010; + machineUUID_ = other.machineUUID_; + onChanged(); + } + if (logTagsBuilder_ == null) { + if (!other.logTags_.isEmpty()) { + if (logTags_.isEmpty()) { + logTags_ = other.logTags_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureLogTagsIsMutable(); + logTags_.addAll(other.logTags_); + } + onChanged(); + } + } else { + if (!other.logTags_.isEmpty()) { + if (logTagsBuilder_.isEmpty()) { + logTagsBuilder_.dispose(); + logTagsBuilder_ = null; + logTags_ = other.logTags_; + bitField0_ = (bitField0_ & ~0x00000020); + logTagsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getLogTagsFieldBuilder() : null; + } else { + logTagsBuilder_.addAllMessages(other.logTags_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getLogsCount(); i++) { + if (!getLogs(i).isInitialized()) { + + return false; + } + } + for (int i = 0; i < getLogTagsCount(); i++) { + if (!getLogTags(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.aliyun.gateway.sls.util.Logs.LogGroup parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.aliyun.gateway.sls.util.Logs.LogGroup) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + private java.util.List logs_ = + java.util.Collections.emptyList(); + private void ensureLogsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + logs_ = new java.util.ArrayList(logs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.Log, com.aliyun.gateway.sls.util.Logs.Log.Builder, com.aliyun.gateway.sls.util.Logs.LogOrBuilder> logsBuilder_; + + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public java.util.List getLogsList() { + if (logsBuilder_ == null) { + return java.util.Collections.unmodifiableList(logs_); + } else { + return logsBuilder_.getMessageList(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public int getLogsCount() { + if (logsBuilder_ == null) { + return logs_.size(); + } else { + return logsBuilder_.getCount(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.Logs.Log getLogs(int index) { + if (logsBuilder_ == null) { + return logs_.get(index); + } else { + return logsBuilder_.getMessage(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public Builder setLogs( + int index, com.aliyun.gateway.sls.util.Logs.Log value) { + if (logsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogsIsMutable(); + logs_.set(index, value); + onChanged(); + } else { + logsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public Builder setLogs( + int index, com.aliyun.gateway.sls.util.Logs.Log.Builder builderForValue) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + logs_.set(index, builderForValue.build()); + onChanged(); + } else { + logsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public Builder addLogs(com.aliyun.gateway.sls.util.Logs.Log value) { + if (logsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogsIsMutable(); + logs_.add(value); + onChanged(); + } else { + logsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public Builder addLogs( + int index, com.aliyun.gateway.sls.util.Logs.Log value) { + if (logsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogsIsMutable(); + logs_.add(index, value); + onChanged(); + } else { + logsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public Builder addLogs( + com.aliyun.gateway.sls.util.Logs.Log.Builder builderForValue) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + logs_.add(builderForValue.build()); + onChanged(); + } else { + logsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public Builder addLogs( + int index, com.aliyun.gateway.sls.util.Logs.Log.Builder builderForValue) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + logs_.add(index, builderForValue.build()); + onChanged(); + } else { + logsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public Builder addAllLogs( + java.lang.Iterable values) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + super.addAll(values, logs_); + onChanged(); + } else { + logsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public Builder clearLogs() { + if (logsBuilder_ == null) { + logs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + logsBuilder_.clear(); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public Builder removeLogs(int index) { + if (logsBuilder_ == null) { + ensureLogsIsMutable(); + logs_.remove(index); + onChanged(); + } else { + logsBuilder_.remove(index); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.Logs.Log.Builder getLogsBuilder( + int index) { + return getLogsFieldBuilder().getBuilder(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.Logs.LogOrBuilder getLogsOrBuilder( + int index) { + if (logsBuilder_ == null) { + return logs_.get(index); } else { + return logsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public java.util.List + getLogsOrBuilderList() { + if (logsBuilder_ != null) { + return logsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(logs_); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.Logs.Log.Builder addLogsBuilder() { + return getLogsFieldBuilder().addBuilder( + com.aliyun.gateway.sls.util.Logs.Log.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public com.aliyun.gateway.sls.util.Logs.Log.Builder addLogsBuilder( + int index) { + return getLogsFieldBuilder().addBuilder( + index, com.aliyun.gateway.sls.util.Logs.Log.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.Log Logs = 1; + */ + public java.util.List + getLogsBuilderList() { + return getLogsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.Log, com.aliyun.gateway.sls.util.Logs.Log.Builder, com.aliyun.gateway.sls.util.Logs.LogOrBuilder> + getLogsFieldBuilder() { + if (logsBuilder_ == null) { + logsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.Log, com.aliyun.gateway.sls.util.Logs.Log.Builder, com.aliyun.gateway.sls.util.Logs.LogOrBuilder>( + logs_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + logs_ = null; + } + return logsBuilder_; + } + + // optional string Category = 2; + private java.lang.Object category_ = ""; + /** + * optional string Category = 2; + */ + public boolean hasCategory() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string Category = 2; + */ + public java.lang.String getCategory() { + java.lang.Object ref = category_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + category_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string Category = 2; + */ + public com.google.protobuf.ByteString + getCategoryBytes() { + java.lang.Object ref = category_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + category_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string Category = 2; + */ + public Builder setCategory( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + category_ = value; + onChanged(); + return this; + } + /** + * optional string Category = 2; + */ + public Builder clearCategory() { + bitField0_ = (bitField0_ & ~0x00000002); + category_ = getDefaultInstance().getCategory(); + onChanged(); + return this; + } + /** + * optional string Category = 2; + */ + public Builder setCategoryBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + category_ = value; + onChanged(); + return this; + } + + // optional string Topic = 3; + private java.lang.Object topic_ = ""; + /** + * optional string Topic = 3; + */ + public boolean hasTopic() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string Topic = 3; + */ + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + topic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string Topic = 3; + */ + public com.google.protobuf.ByteString + getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string Topic = 3; + */ + public Builder setTopic( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + topic_ = value; + onChanged(); + return this; + } + /** + * optional string Topic = 3; + */ + public Builder clearTopic() { + bitField0_ = (bitField0_ & ~0x00000004); + topic_ = getDefaultInstance().getTopic(); + onChanged(); + return this; + } + /** + * optional string Topic = 3; + */ + public Builder setTopicBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + topic_ = value; + onChanged(); + return this; + } + + // optional string Source = 4; + private java.lang.Object source_ = ""; + /** + * optional string Source = 4; + */ + public boolean hasSource() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional string Source = 4; + */ + public java.lang.String getSource() { + java.lang.Object ref = source_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + source_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string Source = 4; + */ + public com.google.protobuf.ByteString + getSourceBytes() { + java.lang.Object ref = source_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + source_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string Source = 4; + */ + public Builder setSource( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + source_ = value; + onChanged(); + return this; + } + /** + * optional string Source = 4; + */ + public Builder clearSource() { + bitField0_ = (bitField0_ & ~0x00000008); + source_ = getDefaultInstance().getSource(); + onChanged(); + return this; + } + /** + * optional string Source = 4; + */ + public Builder setSourceBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + source_ = value; + onChanged(); + return this; + } + + // optional string MachineUUID = 5; + private java.lang.Object machineUUID_ = ""; + /** + * optional string MachineUUID = 5; + */ + public boolean hasMachineUUID() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional string MachineUUID = 5; + */ + public java.lang.String getMachineUUID() { + java.lang.Object ref = machineUUID_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + machineUUID_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string MachineUUID = 5; + */ + public com.google.protobuf.ByteString + getMachineUUIDBytes() { + java.lang.Object ref = machineUUID_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + machineUUID_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string MachineUUID = 5; + */ + public Builder setMachineUUID( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + machineUUID_ = value; + onChanged(); + return this; + } + /** + * optional string MachineUUID = 5; + */ + public Builder clearMachineUUID() { + bitField0_ = (bitField0_ & ~0x00000010); + machineUUID_ = getDefaultInstance().getMachineUUID(); + onChanged(); + return this; + } + /** + * optional string MachineUUID = 5; + */ + public Builder setMachineUUIDBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + machineUUID_ = value; + onChanged(); + return this; + } + + // repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + private java.util.List logTags_ = + java.util.Collections.emptyList(); + private void ensureLogTagsIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + logTags_ = new java.util.ArrayList(logTags_); + bitField0_ |= 0x00000020; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.LogTag, com.aliyun.gateway.sls.util.Logs.LogTag.Builder, com.aliyun.gateway.sls.util.Logs.LogTagOrBuilder> logTagsBuilder_; + + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public java.util.List getLogTagsList() { + if (logTagsBuilder_ == null) { + return java.util.Collections.unmodifiableList(logTags_); + } else { + return logTagsBuilder_.getMessageList(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public int getLogTagsCount() { + if (logTagsBuilder_ == null) { + return logTags_.size(); + } else { + return logTagsBuilder_.getCount(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.Logs.LogTag getLogTags(int index) { + if (logTagsBuilder_ == null) { + return logTags_.get(index); + } else { + return logTagsBuilder_.getMessage(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public Builder setLogTags( + int index, com.aliyun.gateway.sls.util.Logs.LogTag value) { + if (logTagsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogTagsIsMutable(); + logTags_.set(index, value); + onChanged(); + } else { + logTagsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public Builder setLogTags( + int index, com.aliyun.gateway.sls.util.Logs.LogTag.Builder builderForValue) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + logTags_.set(index, builderForValue.build()); + onChanged(); + } else { + logTagsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public Builder addLogTags(com.aliyun.gateway.sls.util.Logs.LogTag value) { + if (logTagsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogTagsIsMutable(); + logTags_.add(value); + onChanged(); + } else { + logTagsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public Builder addLogTags( + int index, com.aliyun.gateway.sls.util.Logs.LogTag value) { + if (logTagsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogTagsIsMutable(); + logTags_.add(index, value); + onChanged(); + } else { + logTagsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public Builder addLogTags( + com.aliyun.gateway.sls.util.Logs.LogTag.Builder builderForValue) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + logTags_.add(builderForValue.build()); + onChanged(); + } else { + logTagsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public Builder addLogTags( + int index, com.aliyun.gateway.sls.util.Logs.LogTag.Builder builderForValue) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + logTags_.add(index, builderForValue.build()); + onChanged(); + } else { + logTagsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public Builder addAllLogTags( + java.lang.Iterable values) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + super.addAll(values, logTags_); + onChanged(); + } else { + logTagsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public Builder clearLogTags() { + if (logTagsBuilder_ == null) { + logTags_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + } else { + logTagsBuilder_.clear(); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public Builder removeLogTags(int index) { + if (logTagsBuilder_ == null) { + ensureLogTagsIsMutable(); + logTags_.remove(index); + onChanged(); + } else { + logTagsBuilder_.remove(index); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.Logs.LogTag.Builder getLogTagsBuilder( + int index) { + return getLogTagsFieldBuilder().getBuilder(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.Logs.LogTagOrBuilder getLogTagsOrBuilder( + int index) { + if (logTagsBuilder_ == null) { + return logTags_.get(index); } else { + return logTagsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public java.util.List + getLogTagsOrBuilderList() { + if (logTagsBuilder_ != null) { + return logTagsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(logTags_); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.Logs.LogTag.Builder addLogTagsBuilder() { + return getLogTagsFieldBuilder().addBuilder( + com.aliyun.gateway.sls.util.Logs.LogTag.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public com.aliyun.gateway.sls.util.Logs.LogTag.Builder addLogTagsBuilder( + int index) { + return getLogTagsFieldBuilder().addBuilder( + index, com.aliyun.gateway.sls.util.Logs.LogTag.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogTag LogTags = 6; + */ + public java.util.List + getLogTagsBuilderList() { + return getLogTagsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.LogTag, com.aliyun.gateway.sls.util.Logs.LogTag.Builder, com.aliyun.gateway.sls.util.Logs.LogTagOrBuilder> + getLogTagsFieldBuilder() { + if (logTagsBuilder_ == null) { + logTagsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.LogTag, com.aliyun.gateway.sls.util.Logs.LogTag.Builder, com.aliyun.gateway.sls.util.Logs.LogTagOrBuilder>( + logTags_, + ((bitField0_ & 0x00000020) == 0x00000020), + getParentForChildren(), + isClean()); + logTags_ = null; + } + return logTagsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.aliyun.gateway.sls.util.LogGroup) + } + + static { + defaultInstance = new LogGroup(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.aliyun.gateway.sls.util.LogGroup) + } + + public interface LogGroupListOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + java.util.List + getLogGroupListList(); + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + com.aliyun.gateway.sls.util.Logs.LogGroup getLogGroupList(int index); + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + int getLogGroupListCount(); + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + java.util.List + getLogGroupListOrBuilderList(); + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + com.aliyun.gateway.sls.util.Logs.LogGroupOrBuilder getLogGroupListOrBuilder( + int index); + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.LogGroupList} + */ + public static final class LogGroupList extends + com.google.protobuf.GeneratedMessage + implements LogGroupListOrBuilder { + // Use LogGroupList.newBuilder() to construct. + private LogGroupList(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private LogGroupList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final LogGroupList defaultInstance; + public static LogGroupList getDefaultInstance() { + return defaultInstance; + } + + public LogGroupList getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private LogGroupList( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + logGroupList_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + logGroupList_.add(input.readMessage(com.aliyun.gateway.sls.util.Logs.LogGroup.PARSER, extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + logGroupList_ = java.util.Collections.unmodifiableList(logGroupList_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroupList_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroupList_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.LogGroupList.class, com.aliyun.gateway.sls.util.Logs.LogGroupList.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public LogGroupList parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LogGroupList(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + // repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + public static final int LOGGROUPLIST_FIELD_NUMBER = 1; + private java.util.List logGroupList_; + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public java.util.List getLogGroupListList() { + return logGroupList_; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public java.util.List + getLogGroupListOrBuilderList() { + return logGroupList_; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public int getLogGroupListCount() { + return logGroupList_.size(); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public com.aliyun.gateway.sls.util.Logs.LogGroup getLogGroupList(int index) { + return logGroupList_.get(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public com.aliyun.gateway.sls.util.Logs.LogGroupOrBuilder getLogGroupListOrBuilder( + int index) { + return logGroupList_.get(index); + } + + private void initFields() { + logGroupList_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getLogGroupListCount(); i++) { + if (!getLogGroupList(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < logGroupList_.size(); i++) { + output.writeMessage(1, logGroupList_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < logGroupList_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, logGroupList_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static com.aliyun.gateway.sls.util.Logs.LogGroupList parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.aliyun.gateway.sls.util.Logs.LogGroupList prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.aliyun.gateway.sls.util.LogGroupList} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.aliyun.gateway.sls.util.Logs.LogGroupListOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroupList_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroupList_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.aliyun.gateway.sls.util.Logs.LogGroupList.class, com.aliyun.gateway.sls.util.Logs.LogGroupList.Builder.class); + } + + // Construct using com.aliyun.gateway.sls.util.Logs.LogGroupList.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getLogGroupListFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (logGroupListBuilder_ == null) { + logGroupList_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + logGroupListBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.aliyun.gateway.sls.util.Logs.internal_static_com_aliyun_openservices_log_common_LogGroupList_descriptor; + } + + public com.aliyun.gateway.sls.util.Logs.LogGroupList getDefaultInstanceForType() { + return com.aliyun.gateway.sls.util.Logs.LogGroupList.getDefaultInstance(); + } + + public com.aliyun.gateway.sls.util.Logs.LogGroupList build() { + com.aliyun.gateway.sls.util.Logs.LogGroupList result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.aliyun.gateway.sls.util.Logs.LogGroupList buildPartial() { + com.aliyun.gateway.sls.util.Logs.LogGroupList result = new com.aliyun.gateway.sls.util.Logs.LogGroupList(this); + int from_bitField0_ = bitField0_; + if (logGroupListBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + logGroupList_ = java.util.Collections.unmodifiableList(logGroupList_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.logGroupList_ = logGroupList_; + } else { + result.logGroupList_ = logGroupListBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.aliyun.gateway.sls.util.Logs.LogGroupList) { + return mergeFrom((com.aliyun.gateway.sls.util.Logs.LogGroupList)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.aliyun.gateway.sls.util.Logs.LogGroupList other) { + if (other == com.aliyun.gateway.sls.util.Logs.LogGroupList.getDefaultInstance()) return this; + if (logGroupListBuilder_ == null) { + if (!other.logGroupList_.isEmpty()) { + if (logGroupList_.isEmpty()) { + logGroupList_ = other.logGroupList_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLogGroupListIsMutable(); + logGroupList_.addAll(other.logGroupList_); + } + onChanged(); + } + } else { + if (!other.logGroupList_.isEmpty()) { + if (logGroupListBuilder_.isEmpty()) { + logGroupListBuilder_.dispose(); + logGroupListBuilder_ = null; + logGroupList_ = other.logGroupList_; + bitField0_ = (bitField0_ & ~0x00000001); + logGroupListBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getLogGroupListFieldBuilder() : null; + } else { + logGroupListBuilder_.addAllMessages(other.logGroupList_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getLogGroupListCount(); i++) { + if (!getLogGroupList(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.aliyun.gateway.sls.util.Logs.LogGroupList parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.aliyun.gateway.sls.util.Logs.LogGroupList) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + private java.util.List logGroupList_ = + java.util.Collections.emptyList(); + private void ensureLogGroupListIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + logGroupList_ = new java.util.ArrayList(logGroupList_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.LogGroup, com.aliyun.gateway.sls.util.Logs.LogGroup.Builder, com.aliyun.gateway.sls.util.Logs.LogGroupOrBuilder> logGroupListBuilder_; + + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public java.util.List getLogGroupListList() { + if (logGroupListBuilder_ == null) { + return java.util.Collections.unmodifiableList(logGroupList_); + } else { + return logGroupListBuilder_.getMessageList(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public int getLogGroupListCount() { + if (logGroupListBuilder_ == null) { + return logGroupList_.size(); + } else { + return logGroupListBuilder_.getCount(); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public com.aliyun.gateway.sls.util.Logs.LogGroup getLogGroupList(int index) { + if (logGroupListBuilder_ == null) { + return logGroupList_.get(index); + } else { + return logGroupListBuilder_.getMessage(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public Builder setLogGroupList( + int index, com.aliyun.gateway.sls.util.Logs.LogGroup value) { + if (logGroupListBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogGroupListIsMutable(); + logGroupList_.set(index, value); + onChanged(); + } else { + logGroupListBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public Builder setLogGroupList( + int index, com.aliyun.gateway.sls.util.Logs.LogGroup.Builder builderForValue) { + if (logGroupListBuilder_ == null) { + ensureLogGroupListIsMutable(); + logGroupList_.set(index, builderForValue.build()); + onChanged(); + } else { + logGroupListBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public Builder addLogGroupList(com.aliyun.gateway.sls.util.Logs.LogGroup value) { + if (logGroupListBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogGroupListIsMutable(); + logGroupList_.add(value); + onChanged(); + } else { + logGroupListBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public Builder addLogGroupList( + int index, com.aliyun.gateway.sls.util.Logs.LogGroup value) { + if (logGroupListBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLogGroupListIsMutable(); + logGroupList_.add(index, value); + onChanged(); + } else { + logGroupListBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public Builder addLogGroupList( + com.aliyun.gateway.sls.util.Logs.LogGroup.Builder builderForValue) { + if (logGroupListBuilder_ == null) { + ensureLogGroupListIsMutable(); + logGroupList_.add(builderForValue.build()); + onChanged(); + } else { + logGroupListBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public Builder addLogGroupList( + int index, com.aliyun.gateway.sls.util.Logs.LogGroup.Builder builderForValue) { + if (logGroupListBuilder_ == null) { + ensureLogGroupListIsMutable(); + logGroupList_.add(index, builderForValue.build()); + onChanged(); + } else { + logGroupListBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public Builder addAllLogGroupList( + java.lang.Iterable values) { + if (logGroupListBuilder_ == null) { + ensureLogGroupListIsMutable(); + super.addAll(values, logGroupList_); + onChanged(); + } else { + logGroupListBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public Builder clearLogGroupList() { + if (logGroupListBuilder_ == null) { + logGroupList_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + logGroupListBuilder_.clear(); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public Builder removeLogGroupList(int index) { + if (logGroupListBuilder_ == null) { + ensureLogGroupListIsMutable(); + logGroupList_.remove(index); + onChanged(); + } else { + logGroupListBuilder_.remove(index); + } + return this; + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public com.aliyun.gateway.sls.util.Logs.LogGroup.Builder getLogGroupListBuilder( + int index) { + return getLogGroupListFieldBuilder().getBuilder(index); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public com.aliyun.gateway.sls.util.Logs.LogGroupOrBuilder getLogGroupListOrBuilder( + int index) { + if (logGroupListBuilder_ == null) { + return logGroupList_.get(index); } else { + return logGroupListBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public java.util.List + getLogGroupListOrBuilderList() { + if (logGroupListBuilder_ != null) { + return logGroupListBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(logGroupList_); + } + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public com.aliyun.gateway.sls.util.Logs.LogGroup.Builder addLogGroupListBuilder() { + return getLogGroupListFieldBuilder().addBuilder( + com.aliyun.gateway.sls.util.Logs.LogGroup.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public com.aliyun.gateway.sls.util.Logs.LogGroup.Builder addLogGroupListBuilder( + int index) { + return getLogGroupListFieldBuilder().addBuilder( + index, com.aliyun.gateway.sls.util.Logs.LogGroup.getDefaultInstance()); + } + /** + * repeated .com.aliyun.gateway.sls.util.LogGroup logGroupList = 1; + */ + public java.util.List + getLogGroupListBuilderList() { + return getLogGroupListFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.LogGroup, com.aliyun.gateway.sls.util.Logs.LogGroup.Builder, com.aliyun.gateway.sls.util.Logs.LogGroupOrBuilder> + getLogGroupListFieldBuilder() { + if (logGroupListBuilder_ == null) { + logGroupListBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.aliyun.gateway.sls.util.Logs.LogGroup, com.aliyun.gateway.sls.util.Logs.LogGroup.Builder, com.aliyun.gateway.sls.util.Logs.LogGroupOrBuilder>( + logGroupList_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + logGroupList_ = null; + } + return logGroupListBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.aliyun.gateway.sls.util.LogGroupList) + } + + static { + defaultInstance = new LogGroupList(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.aliyun.gateway.sls.util.LogGroupList) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_aliyun_openservices_log_common_Log_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_aliyun_openservices_log_common_Log_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_aliyun_openservices_log_common_Log_Content_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_aliyun_openservices_log_common_Log_Content_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_aliyun_openservices_log_common_LogTag_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_aliyun_openservices_log_common_LogTag_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_aliyun_openservices_log_common_LogGroup_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_aliyun_openservices_log_common_LogGroup_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_aliyun_openservices_log_common_LogGroupList_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_aliyun_openservices_log_common_LogGroupList_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\nLogs.proto\022\"com.aliyun.openservices.lo" + + "g.common\"\216\001\n\003Log\022\014\n\004Time\030\001 \002(\r\022A\n\010Conten" + + "ts\030\002 \003(\0132/.com.aliyun.openservices.log.c" + + "ommon.Log.Content\022\017\n\007Time_ns\030\004 \001(\007\032%\n\007Co" + + "ntent\022\013\n\003Key\030\001 \002(\t\022\r\n\005Value\030\002 \002(\t\"$\n\006Log" + + "Tag\022\013\n\003Key\030\001 \002(\t\022\r\n\005Value\030\002 \002(\t\"\304\001\n\010LogG" + + "roup\0225\n\004Logs\030\001 \003(\0132\'.com.aliyun.openserv" + + "ices.log.common.Log\022\020\n\010Category\030\002 \001(\t\022\r\n" + + "\005Topic\030\003 \001(\t\022\016\n\006Source\030\004 \001(\t\022\023\n\013MachineU" + + "UID\030\005 \001(\t\022;\n\007LogTags\030\006 \003(\0132*.com.aliyun.", + "openservices.log.common.LogTag\"R\n\014LogGro" + + "upList\022B\n\014logGroupList\030\001 \003(\0132,.com.aliyu" + + "n.openservices.log.common.LogGroup" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_com_aliyun_openservices_log_common_Log_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_aliyun_openservices_log_common_Log_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_aliyun_openservices_log_common_Log_descriptor, + new java.lang.String[] { "Time", "Contents", "TimeNs", }); + internal_static_com_aliyun_openservices_log_common_Log_Content_descriptor = + internal_static_com_aliyun_openservices_log_common_Log_descriptor.getNestedTypes().get(0); + internal_static_com_aliyun_openservices_log_common_Log_Content_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_aliyun_openservices_log_common_Log_Content_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_com_aliyun_openservices_log_common_LogTag_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_aliyun_openservices_log_common_LogTag_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_aliyun_openservices_log_common_LogTag_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_com_aliyun_openservices_log_common_LogGroup_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_aliyun_openservices_log_common_LogGroup_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_aliyun_openservices_log_common_LogGroup_descriptor, + new java.lang.String[] { "Logs", "Category", "Topic", "Source", "MachineUUID", "LogTags", }); + internal_static_com_aliyun_openservices_log_common_LogGroupList_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_aliyun_openservices_log_common_LogGroupList_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_aliyun_openservices_log_common_LogGroupList_descriptor, + new java.lang.String[] { "LogGroupList", }); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +} \ No newline at end of file diff --git a/alibabacloud-gateway-sls/util/main.tea b/alibabacloud-gateway-sls/util/main.tea index 287942c7..7ecbcb8a 100644 --- a/alibabacloud-gateway-sls/util/main.tea +++ b/alibabacloud-gateway-sls/util/main.tea @@ -18,4 +18,7 @@ static async function compress(src: bytes, compressType: string): bytes static async function isCompressorAvailable(compressType: string): boolean static async function isDecompressorAvailable(compressType: string): boolean -static async function bytesLength(src: bytes): int64 \ No newline at end of file +static async function bytesLength(src: bytes): int64 + + +static async function serializeLogGroupToPB(logGroup: any): bytes \ No newline at end of file From 7c5b0df6628c4266097d2814f6ebfb8c1d5240ee Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 14:03:20 +0800 Subject: [PATCH 02/12] shade google protobuf --- alibabacloud-gateway-sls/util/java/pom.xml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/alibabacloud-gateway-sls/util/java/pom.xml b/alibabacloud-gateway-sls/util/java/pom.xml index 93742da0..305d311c 100644 --- a/alibabacloud-gateway-sls/util/java/pom.xml +++ b/alibabacloud-gateway-sls/util/java/pom.xml @@ -128,6 +128,36 @@ published + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + + com.google.protobuf + com.aliyun.gateway.sls.thirdparty.com.google.protobuf + + + + + + *:* + + **/pom.xml + + + + + + + package + + shade + + + + \ No newline at end of file From 448619fa8f27bae792b3b9e95f8180b0ebf44fec Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 14:04:27 +0800 Subject: [PATCH 03/12] bump version 0.4.0 --- alibabacloud-gateway-sls/util/java/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alibabacloud-gateway-sls/util/java/pom.xml b/alibabacloud-gateway-sls/util/java/pom.xml index 305d311c..f5ffc3aa 100644 --- a/alibabacloud-gateway-sls/util/java/pom.xml +++ b/alibabacloud-gateway-sls/util/java/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.aliyun alibabacloud-gateway-sls-util - 0.3.0 + 0.4.0 jar alibabacloud-gateway-sls-util From 991b99aec598fadfdc22fd399215fe0d1aa53766 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 14:51:35 +0800 Subject: [PATCH 04/12] =?UTF-8?q?Java=20=E6=94=AF=E6=8C=81=20PutLogs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alibabacloud-gateway-sls/java/pom.xml | 14 +++++++------- .../main/java/com/aliyun/gateway/sls/Client.java | 6 +++++- alibabacloud-gateway-sls/main.tea | 7 ++++++- alibabacloud-gateway-sls/util/Teafile | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/alibabacloud-gateway-sls/java/pom.xml b/alibabacloud-gateway-sls/java/pom.xml index fdbebb95..a8eb0412 100644 --- a/alibabacloud-gateway-sls/java/pom.xml +++ b/alibabacloud-gateway-sls/java/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.aliyun alibabacloud-gateway-sls - 0.3.0 + 0.4.0 jar alibabacloud-gateway-sls @@ -49,12 +49,12 @@ com.aliyun alibabacloud-gateway-spi - 0.0.2 + 0.0.3 com.aliyun credentials-java - 0.3.6 + 1.0.2 com.aliyun @@ -64,7 +64,7 @@ com.aliyun openapiutil - 0.2.1 + 0.2.2 com.aliyun @@ -84,12 +84,12 @@ com.aliyun darabonba-encode-util - 0.0.2 + 0.0.3 com.aliyun darabonba-signature-util - 0.0.4 + 0.0.5 com.aliyun @@ -99,7 +99,7 @@ com.aliyun alibabacloud-gateway-sls-util - 0.3.0 + 0.4.0 diff --git a/alibabacloud-gateway-sls/java/src/main/java/com/aliyun/gateway/sls/Client.java b/alibabacloud-gateway-sls/java/src/main/java/com/aliyun/gateway/sls/Client.java index 56d8e2b7..75d76114 100644 --- a/alibabacloud-gateway-sls/java/src/main/java/com/aliyun/gateway/sls/Client.java +++ b/alibabacloud-gateway-sls/java/src/main/java/com/aliyun/gateway/sls/Client.java @@ -66,7 +66,11 @@ public void modifyRequest(com.aliyun.gateway.spi.models.InterceptorContext conte // get body bytes byte[] bodyBytes = null; if (!com.aliyun.teautil.Common.isUnset(request.body)) { - if (com.aliyun.darabonbastring.Client.equals(request.reqBodyType, "json") || com.aliyun.darabonbastring.Client.equals(request.reqBodyType, "formData")) { + // PutLogs + if (com.aliyun.darabonbastring.Client.equals(request.action, "PutLogs")) { + bodyBytes = com.aliyun.gateway.sls.util.Client.serializeLogGroupToPB(request.body); + request.headers.put("content-type", "application/x-protobuf"); + } else if (com.aliyun.darabonbastring.Client.equals(request.reqBodyType, "json") || com.aliyun.darabonbastring.Client.equals(request.reqBodyType, "formData")) { request.headers.put("content-type", "application/json"); String bodyStr = com.aliyun.teautil.Common.toJSONString(request.body); bodyBytes = com.aliyun.teautil.Common.toBytes(bodyStr); diff --git a/alibabacloud-gateway-sls/main.tea b/alibabacloud-gateway-sls/main.tea index 40cad4a0..783e2fbe 100644 --- a/alibabacloud-gateway-sls/main.tea +++ b/alibabacloud-gateway-sls/main.tea @@ -57,7 +57,12 @@ async function modifyRequest(context: SPI.InterceptorContext, attributeMap: SPI. // get body bytes var bodyBytes : bytes = null; if (!Util.isUnset(request.body)) { - if (String.equals(request.reqBodyType, 'json') || String.equals(request.reqBodyType, 'formData')) { + + // PutLogs + if (String.equals(request.action, 'PutLogs')) { + bodyBytes = SLS_Util.serializeLogGroupToPB(request.body); + request.headers['content-type'] = 'application/x-protobuf'; + } else if (String.equals(request.reqBodyType, 'json') || String.equals(request.reqBodyType, 'formData')) { request.headers['content-type'] = 'application/json'; var bodyStr = Util.toJSONString(request.body); bodyBytes = Util.toBytes(bodyStr); diff --git a/alibabacloud-gateway-sls/util/Teafile b/alibabacloud-gateway-sls/util/Teafile index 3ec91363..0c4e6941 100644 --- a/alibabacloud-gateway-sls/util/Teafile +++ b/alibabacloud-gateway-sls/util/Teafile @@ -1,7 +1,7 @@ { "scope": "alibabacloud", "name": "GatewaySLS_Util", - "version": "0.0.4", + "version": "0.0.5", "main": "./main.tea", "maintainers": [ { From 1644646da519935043829ab226ce1cad5b9f25c5 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 15:14:27 +0800 Subject: [PATCH 05/12] =?UTF-8?q?include=20=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alibabacloud-gateway-sls/util/java/pom.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/alibabacloud-gateway-sls/util/java/pom.xml b/alibabacloud-gateway-sls/util/java/pom.xml index f5ffc3aa..d5f3ba37 100644 --- a/alibabacloud-gateway-sls/util/java/pom.xml +++ b/alibabacloud-gateway-sls/util/java/pom.xml @@ -54,12 +54,12 @@ com.aliyun tea - 1.2.3 + 1.3.3 com.aliyun tea-util - 0.2.14 + 0.2.23 com.github.luben @@ -133,6 +133,11 @@ maven-shade-plugin 3.2.4 + + + com.google.protobuf:protobuf-java + + com.google.protobuf From 6e275f160de9f6ebd551ed7292df840de3818293 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 16:11:27 +0800 Subject: [PATCH 06/12] fix include --- alibabacloud-gateway-sls/util/java/pom.xml | 9 +++++--- .../gateway/sls/util/LogGroupSerializer.java | 23 ++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/alibabacloud-gateway-sls/util/java/pom.xml b/alibabacloud-gateway-sls/util/java/pom.xml index d5f3ba37..5187f0c1 100644 --- a/alibabacloud-gateway-sls/util/java/pom.xml +++ b/alibabacloud-gateway-sls/util/java/pom.xml @@ -148,9 +148,12 @@ *:* - - **/pom.xml - + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + **/pom.xml + diff --git a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/LogGroupSerializer.java b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/LogGroupSerializer.java index 96918ccc..15e433a6 100644 --- a/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/LogGroupSerializer.java +++ b/alibabacloud-gateway-sls/util/java/src/main/java/com/aliyun/gateway/sls/util/LogGroupSerializer.java @@ -38,10 +38,16 @@ public static byte[] serializeLogGroupToPB(Object logGroup) throws Exception { @SuppressWarnings("unchecked") private static void serializeLogs(Logs.LogGroup.Builder logs, HashMap body) { - ArrayList logItems = (ArrayList) body.get("Logs"); + ArrayList logItems = (ArrayList) body.get("LogItems"); + if (logItems == null) { + return; + } for (Object obj : logItems) { Logs.Log.Builder logsBuilder = logs.addLogsBuilder(); HashMap logItem = (HashMap) obj; + if (logItem == null) { + continue; + } logsBuilder.setTime((Integer) logItem.get("Time")); ArrayList contents = (ArrayList) logItem.get("Contents"); for (Object content : contents) { @@ -60,13 +66,14 @@ private static void serializeLogs(Logs.LogGroup.Builder logs, HashMap body) { ArrayList logTags = (ArrayList) body.get("LogTags"); - if (logTags != null) { - for (Object obj : logTags) { - HashMap tag = (HashMap) obj; - Logs.LogTag.Builder tagBuilder = logs.addLogTagsBuilder(); - tagBuilder.setKey(tag.get("Key")); - tagBuilder.setValue(tag.get("Value")); - } + if (logTags == null) { + return; + } + for (Object obj : logTags) { + HashMap tag = (HashMap) obj; + Logs.LogTag.Builder tagBuilder = logs.addLogTagsBuilder(); + tagBuilder.setKey(tag.get("Key")); + tagBuilder.setValue(tag.get("Value")); } } From 0c0181f43ba4b5f39b338414ff71733284f5ef54 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 16:14:23 +0800 Subject: [PATCH 07/12] add release note --- alibabacloud-gateway-sls/Teafile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alibabacloud-gateway-sls/Teafile b/alibabacloud-gateway-sls/Teafile index 5bb58792..f11876a3 100644 --- a/alibabacloud-gateway-sls/Teafile +++ b/alibabacloud-gateway-sls/Teafile @@ -1,7 +1,7 @@ { "scope": "alibabacloud", "name": "GatewaySLS", - "version": "0.1.11", + "version": "0.1.12", "main": "./main.tea", "maintainers": [ { @@ -93,7 +93,7 @@ }, "releaselog": { "changelog": [ - "feat: sls support auto compress." + "[java]feat: sls java sdk support PutLogs with protobuf." ], "compatible": true } From 2fd805484940942376bbc2e66420cdd49389e821 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 18:25:20 +0800 Subject: [PATCH 08/12] =?UTF-8?q?golang=20=E6=94=AF=E6=8C=81=20PutLogs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../golang/client/client.go | 10 +- alibabacloud-gateway-sls/golang/go.mod | 2 +- .../util/golang/client/client.go | 4 + .../util/golang/client/log.pb.go | 1997 +++++++++++++++++ .../util/golang/client/log_serializer.go | 218 ++ alibabacloud-gateway-sls/util/golang/go.mod | 4 + alibabacloud-gateway-sls/util/golang/go.sum | 34 + 7 files changed, 2267 insertions(+), 2 deletions(-) create mode 100644 alibabacloud-gateway-sls/util/golang/client/log.pb.go create mode 100644 alibabacloud-gateway-sls/util/golang/client/log_serializer.go diff --git a/alibabacloud-gateway-sls/golang/client/client.go b/alibabacloud-gateway-sls/golang/client/client.go index 36501395..ec14c0bf 100644 --- a/alibabacloud-gateway-sls/golang/client/client.go +++ b/alibabacloud-gateway-sls/golang/client/client.go @@ -85,7 +85,15 @@ func (client *Client) ModifyRequest(context *spi.InterceptorContext, attributeMa // get body bytes var bodyBytes []byte if !tea.BoolValue(util.IsUnset(request.Body)) { - if tea.BoolValue(string_.Equals(request.ReqBodyType, tea.String("json"))) || tea.BoolValue(string_.Equals(request.ReqBodyType, tea.String("formData"))) { + // PutLogs + if tea.BoolValue(string_.Equals(request.Action, tea.String("PutLogs"))) { + bodyBytes, _err = sls_util.SerializeLogGroupToPB(request.Body) + if _err != nil { + return _err + } + + request.Headers["content-type"] = tea.String("application/x-protobuf") + } else if tea.BoolValue(string_.Equals(request.ReqBodyType, tea.String("json"))) || tea.BoolValue(string_.Equals(request.ReqBodyType, tea.String("formData"))) { request.Headers["content-type"] = tea.String("application/json") bodyStr := util.ToJSONString(request.Body) bodyBytes = util.ToBytes(bodyStr) diff --git a/alibabacloud-gateway-sls/golang/go.mod b/alibabacloud-gateway-sls/golang/go.mod index 882b2546..abd6c19b 100644 --- a/alibabacloud-gateway-sls/golang/go.mod +++ b/alibabacloud-gateway-sls/golang/go.mod @@ -10,7 +10,7 @@ require ( github.com/alibabacloud-go/darabonba-map v0.0.2 github.com/alibabacloud-go/darabonba-signature-util v0.0.7 github.com/alibabacloud-go/darabonba-string v1.0.2 - github.com/alibabacloud-go/openapi-util v0.1.0 + github.com/alibabacloud-go/openapi-util v0.1.1 github.com/alibabacloud-go/tea v1.2.3-0.20240605082020-e6e537a31150 github.com/alibabacloud-go/tea-utils/v2 v2.0.6 ) diff --git a/alibabacloud-gateway-sls/util/golang/client/client.go b/alibabacloud-gateway-sls/util/golang/client/client.go index 7fada8e5..722bb523 100644 --- a/alibabacloud-gateway-sls/util/golang/client/client.go +++ b/alibabacloud-gateway-sls/util/golang/client/client.go @@ -81,3 +81,7 @@ func IsDecompressorAvailable(compressType *string) (_result *bool) { func BytesLength(src []byte) (_result *int64) { return tea.Int64(int64(len(src))) } + +func SerializeLogGroupToPB(logGroup interface{}) (_result []byte, _err error) { + return serializeLogGroupToPB(logGroup) +} diff --git a/alibabacloud-gateway-sls/util/golang/client/log.pb.go b/alibabacloud-gateway-sls/util/golang/client/log.pb.go new file mode 100644 index 00000000..b49e6eda --- /dev/null +++ b/alibabacloud-gateway-sls/util/golang/client/log.pb.go @@ -0,0 +1,1997 @@ +package client + +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: log.proto + +import ( + encoding_binary "encoding/binary" + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + _ "github.com/gogo/protobuf/gogoproto" + github_com_golang_protobuf_proto "github.com/golang/protobuf/proto" + proto "github.com/golang/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type LogContent struct { + Key *string `protobuf:"bytes,1,req,name=Key" json:"Key,omitempty"` + Value *string `protobuf:"bytes,2,req,name=Value" json:"Value,omitempty"` + _key string + _value string + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogContent) Reset() { *m = LogContent{} } +func (m *LogContent) String() string { return proto.CompactTextString(m) } +func (*LogContent) ProtoMessage() {} +func (*LogContent) Descriptor() ([]byte, []int) { + return fileDescriptor_a153da538f858886, []int{0} +} +func (m *LogContent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LogContent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LogContent.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LogContent) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogContent.Merge(m, src) +} +func (m *LogContent) XXX_Size() int { + return m.Size() +} +func (m *LogContent) XXX_DiscardUnknown() { + xxx_messageInfo_LogContent.DiscardUnknown(m) +} + +var xxx_messageInfo_LogContent proto.InternalMessageInfo + +func (m *LogContent) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *LogContent) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type Log struct { + Time *uint32 `protobuf:"varint,1,req,name=Time" json:"Time,omitempty"` + Contents []*LogContent `protobuf:"bytes,2,rep,name=Contents" json:"Contents,omitempty"` + TimeNs *uint32 `protobuf:"fixed32,4,opt,name=TimeNs" json:"TimeNs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Log) Reset() { *m = Log{} } +func (m *Log) String() string { return proto.CompactTextString(m) } +func (*Log) ProtoMessage() {} +func (*Log) Descriptor() ([]byte, []int) { + return fileDescriptor_a153da538f858886, []int{1} +} +func (m *Log) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Log.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Log) XXX_Merge(src proto.Message) { + xxx_messageInfo_Log.Merge(m, src) +} +func (m *Log) XXX_Size() int { + return m.Size() +} +func (m *Log) XXX_DiscardUnknown() { + xxx_messageInfo_Log.DiscardUnknown(m) +} + +var xxx_messageInfo_Log proto.InternalMessageInfo + +func (m *Log) GetTime() uint32 { + if m != nil && m.Time != nil { + return *m.Time + } + return 0 +} + +func (m *Log) GetContents() []*LogContent { + if m != nil { + return m.Contents + } + return nil +} + +func (m *Log) GetTimeNs() uint32 { + if m != nil && m.TimeNs != nil { + return *m.TimeNs + } + return 0 +} + +type LogTag struct { + Key *string `protobuf:"bytes,1,req,name=Key" json:"Key,omitempty"` + Value *string `protobuf:"bytes,2,req,name=Value" json:"Value,omitempty"` + _key string + _value string + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogTag) Reset() { *m = LogTag{} } +func (m *LogTag) String() string { return proto.CompactTextString(m) } +func (*LogTag) ProtoMessage() {} +func (*LogTag) Descriptor() ([]byte, []int) { + return fileDescriptor_a153da538f858886, []int{2} +} +func (m *LogTag) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LogTag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LogTag.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LogTag) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogTag.Merge(m, src) +} +func (m *LogTag) XXX_Size() int { + return m.Size() +} +func (m *LogTag) XXX_DiscardUnknown() { + xxx_messageInfo_LogTag.DiscardUnknown(m) +} + +var xxx_messageInfo_LogTag proto.InternalMessageInfo + +func (m *LogTag) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *LogTag) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type LogGroup struct { + Logs []*Log `protobuf:"bytes,1,rep,name=Logs" json:"Logs,omitempty"` + Category *string `protobuf:"bytes,2,opt,name=Category" json:"Category,omitempty"` + Topic *string `protobuf:"bytes,3,opt,name=Topic" json:"Topic,omitempty"` + Source *string `protobuf:"bytes,4,opt,name=Source" json:"Source,omitempty"` + MachineUUID *string `protobuf:"bytes,5,opt,name=MachineUUID" json:"MachineUUID,omitempty"` + LogTags []*LogTag `protobuf:"bytes,6,rep,name=LogTags" json:"LogTags,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogGroup) Reset() { *m = LogGroup{} } +func (m *LogGroup) String() string { return proto.CompactTextString(m) } +func (*LogGroup) ProtoMessage() {} +func (*LogGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_a153da538f858886, []int{3} +} +func (m *LogGroup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LogGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LogGroup.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LogGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogGroup.Merge(m, src) +} +func (m *LogGroup) XXX_Size() int { + return m.Size() +} +func (m *LogGroup) XXX_DiscardUnknown() { + xxx_messageInfo_LogGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_LogGroup proto.InternalMessageInfo + +func (m *LogGroup) GetLogs() []*Log { + if m != nil { + return m.Logs + } + return nil +} + +func (m *LogGroup) GetCategory() string { + if m != nil && m.Category != nil { + return *m.Category + } + return "" +} + +func (m *LogGroup) GetTopic() string { + if m != nil && m.Topic != nil { + return *m.Topic + } + return "" +} + +func (m *LogGroup) GetSource() string { + if m != nil && m.Source != nil { + return *m.Source + } + return "" +} + +func (m *LogGroup) GetMachineUUID() string { + if m != nil && m.MachineUUID != nil { + return *m.MachineUUID + } + return "" +} + +func (m *LogGroup) GetLogTags() []*LogTag { + if m != nil { + return m.LogTags + } + return nil +} + +type SlsLogPackage struct { + Data []byte `protobuf:"bytes,1,req,name=data" json:"data,omitempty"` + UncompressSize *int32 `protobuf:"varint,2,opt,name=uncompress_size,json=uncompressSize" json:"uncompress_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SlsLogPackage) Reset() { *m = SlsLogPackage{} } +func (m *SlsLogPackage) String() string { return proto.CompactTextString(m) } +func (*SlsLogPackage) ProtoMessage() {} +func (*SlsLogPackage) Descriptor() ([]byte, []int) { + return fileDescriptor_a153da538f858886, []int{4} +} +func (m *SlsLogPackage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SlsLogPackage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SlsLogPackage.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SlsLogPackage) XXX_Merge(src proto.Message) { + xxx_messageInfo_SlsLogPackage.Merge(m, src) +} +func (m *SlsLogPackage) XXX_Size() int { + return m.Size() +} +func (m *SlsLogPackage) XXX_DiscardUnknown() { + xxx_messageInfo_SlsLogPackage.DiscardUnknown(m) +} + +var xxx_messageInfo_SlsLogPackage proto.InternalMessageInfo + +func (m *SlsLogPackage) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *SlsLogPackage) GetUncompressSize() int32 { + if m != nil && m.UncompressSize != nil { + return *m.UncompressSize + } + return 0 +} + +type SlsLogPackageList struct { + Packages []*SlsLogPackage `protobuf:"bytes,1,rep,name=packages" json:"packages,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SlsLogPackageList) Reset() { *m = SlsLogPackageList{} } +func (m *SlsLogPackageList) String() string { return proto.CompactTextString(m) } +func (*SlsLogPackageList) ProtoMessage() {} +func (*SlsLogPackageList) Descriptor() ([]byte, []int) { + return fileDescriptor_a153da538f858886, []int{5} +} +func (m *SlsLogPackageList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SlsLogPackageList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SlsLogPackageList.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SlsLogPackageList) XXX_Merge(src proto.Message) { + xxx_messageInfo_SlsLogPackageList.Merge(m, src) +} +func (m *SlsLogPackageList) XXX_Size() int { + return m.Size() +} +func (m *SlsLogPackageList) XXX_DiscardUnknown() { + xxx_messageInfo_SlsLogPackageList.DiscardUnknown(m) +} + +var xxx_messageInfo_SlsLogPackageList proto.InternalMessageInfo + +func (m *SlsLogPackageList) GetPackages() []*SlsLogPackage { + if m != nil { + return m.Packages + } + return nil +} + +type LogGroupList struct { + LogGroups []*LogGroup `protobuf:"bytes,1,rep,name=LogGroups" json:"LogGroups,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogGroupList) Reset() { *m = LogGroupList{} } +func (m *LogGroupList) String() string { return proto.CompactTextString(m) } +func (*LogGroupList) ProtoMessage() {} +func (*LogGroupList) Descriptor() ([]byte, []int) { + return fileDescriptor_a153da538f858886, []int{6} +} +func (m *LogGroupList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LogGroupList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LogGroupList.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LogGroupList) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogGroupList.Merge(m, src) +} +func (m *LogGroupList) XXX_Size() int { + return m.Size() +} +func (m *LogGroupList) XXX_DiscardUnknown() { + xxx_messageInfo_LogGroupList.DiscardUnknown(m) +} + +var xxx_messageInfo_LogGroupList proto.InternalMessageInfo + +func (m *LogGroupList) GetLogGroups() []*LogGroup { + if m != nil { + return m.LogGroups + } + return nil +} + +func init() { + proto.RegisterType((*LogContent)(nil), "sls.LogContent") + proto.RegisterType((*Log)(nil), "sls.Log") + proto.RegisterType((*LogTag)(nil), "sls.LogTag") + proto.RegisterType((*LogGroup)(nil), "sls.LogGroup") + proto.RegisterType((*SlsLogPackage)(nil), "sls.SlsLogPackage") + proto.RegisterType((*SlsLogPackageList)(nil), "sls.SlsLogPackageList") + proto.RegisterType((*LogGroupList)(nil), "sls.LogGroupList") +} + +func init() { proto.RegisterFile("log.proto", fileDescriptor_a153da538f858886) } + +var fileDescriptor_a153da538f858886 = []byte{ + // 412 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0xdf, 0x8a, 0xd3, 0x40, + 0x14, 0xc6, 0x9d, 0xa6, 0xed, 0x26, 0xa7, 0x5b, 0x77, 0x1d, 0x44, 0x86, 0x45, 0x4a, 0x08, 0x88, + 0x85, 0xc5, 0xac, 0x88, 0x77, 0xde, 0x59, 0x41, 0xc4, 0x51, 0x64, 0xda, 0xf5, 0x52, 0x99, 0x8d, + 0xe3, 0x6c, 0x30, 0xcd, 0x09, 0x99, 0xe4, 0x62, 0xf7, 0x49, 0x7c, 0x17, 0x5f, 0xc0, 0x4b, 0x1f, + 0x41, 0xea, 0x8b, 0x48, 0x4e, 0x3a, 0xad, 0xbd, 0xf3, 0xee, 0xfc, 0xce, 0x77, 0xfe, 0x7c, 0xe7, + 0x40, 0x54, 0xa0, 0x4d, 0xab, 0x1a, 0x1b, 0xe4, 0x81, 0x2b, 0xdc, 0xd9, 0x13, 0x9b, 0x37, 0xd7, + 0xed, 0x55, 0x9a, 0xe1, 0xfa, 0xc2, 0xa2, 0xc5, 0x0b, 0xd2, 0xae, 0xda, 0xaf, 0x44, 0x04, 0x14, + 0xf5, 0x3d, 0xc9, 0x73, 0x00, 0x89, 0x76, 0x81, 0x65, 0x63, 0xca, 0x86, 0x9f, 0x42, 0xf0, 0xd6, + 0xdc, 0x08, 0x16, 0x0f, 0xe6, 0x91, 0xea, 0x42, 0x7e, 0x1f, 0x46, 0x1f, 0x75, 0xd1, 0x1a, 0x31, + 0xa0, 0x5c, 0x0f, 0xc9, 0x27, 0x08, 0x24, 0x5a, 0xce, 0x61, 0xb8, 0xca, 0xd7, 0x86, 0xea, 0xa7, + 0x8a, 0x62, 0x7e, 0x0e, 0xe1, 0x76, 0x9a, 0x13, 0x83, 0x38, 0x98, 0x4f, 0x9e, 0x9d, 0xa4, 0xae, + 0x70, 0xe9, 0x7e, 0x8b, 0xda, 0x15, 0xf0, 0x07, 0x30, 0xee, 0x9a, 0xde, 0x3b, 0x31, 0x8c, 0xd9, + 0xfc, 0x48, 0x6d, 0x29, 0x79, 0x0a, 0x63, 0x89, 0x76, 0xa5, 0xed, 0x7f, 0x3b, 0xfa, 0xc1, 0x20, + 0x94, 0x68, 0x5f, 0xd7, 0xd8, 0x56, 0xfc, 0x21, 0x0c, 0x25, 0x5a, 0x27, 0x18, 0xed, 0x0f, 0xfd, + 0x7e, 0x45, 0x59, 0x7e, 0x06, 0xe1, 0x42, 0x37, 0xc6, 0x62, 0x7d, 0x23, 0x06, 0x31, 0x9b, 0x47, + 0x6a, 0xc7, 0xdd, 0xf0, 0x15, 0x56, 0x79, 0x26, 0x02, 0x12, 0x7a, 0xe8, 0x6c, 0x2e, 0xb1, 0xad, + 0x33, 0x43, 0x36, 0x23, 0xb5, 0x25, 0x1e, 0xc3, 0xe4, 0x9d, 0xce, 0xae, 0xf3, 0xd2, 0x5c, 0x5e, + 0xbe, 0x79, 0x25, 0x46, 0x24, 0xfe, 0x9b, 0xe2, 0x8f, 0xe0, 0xa8, 0x3f, 0xc4, 0x89, 0x31, 0x99, + 0x99, 0x78, 0x33, 0x2b, 0x6d, 0x95, 0xd7, 0x12, 0x09, 0xd3, 0x65, 0xe1, 0x24, 0xda, 0x0f, 0x3a, + 0xfb, 0xa6, 0xad, 0xe9, 0x3e, 0xfb, 0x45, 0x37, 0x9a, 0xee, 0x3e, 0x56, 0x14, 0xf3, 0xc7, 0x70, + 0xd2, 0x96, 0x19, 0xae, 0xab, 0xda, 0x38, 0xf7, 0xd9, 0xe5, 0xb7, 0x86, 0xec, 0x8f, 0xd4, 0xdd, + 0x7d, 0x7a, 0x99, 0xdf, 0x9a, 0x64, 0x01, 0xf7, 0x0e, 0xa6, 0xc9, 0xdc, 0x35, 0x3c, 0x85, 0xb0, + 0xea, 0xd1, 0xff, 0x85, 0x93, 0x95, 0x83, 0x4a, 0xb5, 0xab, 0x49, 0x5e, 0xc0, 0xb1, 0xff, 0x27, + 0xf5, 0x9f, 0x43, 0xe4, 0xd9, 0x0f, 0x98, 0xfa, 0x5b, 0x28, 0xab, 0xf6, 0xfa, 0xcb, 0xd3, 0x9f, + 0x9b, 0x19, 0xfb, 0xb5, 0x99, 0xb1, 0xdf, 0x9b, 0x19, 0xfb, 0xfe, 0x67, 0x76, 0xe7, 0x6f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x66, 0x67, 0x4d, 0x9a, 0xa7, 0x02, 0x00, 0x00, +} + +func (m *LogContent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LogContent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LogContent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Value == nil { + return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError) + } else { + i -= len(*m.Value) + copy(dAtA[i:], *m.Value) + i = encodeVarintLog(dAtA, i, uint64(len(*m.Value))) + i-- + dAtA[i] = 0x12 + } + if m.Key == nil { + return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError) + } else { + i -= len(*m.Key) + copy(dAtA[i:], *m.Key) + i = encodeVarintLog(dAtA, i, uint64(len(*m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Log) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Log) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Log) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TimeNs != nil { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(*m.TimeNs)) + i-- + dAtA[i] = 0x25 + } + if len(m.Contents) > 0 { + for iNdEx := len(m.Contents) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Contents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLog(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Time == nil { + return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError) + } else { + i = encodeVarintLog(dAtA, i, uint64(*m.Time)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *LogTag) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LogTag) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LogTag) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Value == nil { + return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError) + } else { + i -= len(*m.Value) + copy(dAtA[i:], *m.Value) + i = encodeVarintLog(dAtA, i, uint64(len(*m.Value))) + i-- + dAtA[i] = 0x12 + } + if m.Key == nil { + return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError) + } else { + i -= len(*m.Key) + copy(dAtA[i:], *m.Key) + i = encodeVarintLog(dAtA, i, uint64(len(*m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *LogGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LogGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LogGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.LogTags) > 0 { + for iNdEx := len(m.LogTags) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LogTags[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLog(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.MachineUUID != nil { + i -= len(*m.MachineUUID) + copy(dAtA[i:], *m.MachineUUID) + i = encodeVarintLog(dAtA, i, uint64(len(*m.MachineUUID))) + i-- + dAtA[i] = 0x2a + } + if m.Source != nil { + i -= len(*m.Source) + copy(dAtA[i:], *m.Source) + i = encodeVarintLog(dAtA, i, uint64(len(*m.Source))) + i-- + dAtA[i] = 0x22 + } + if m.Topic != nil { + i -= len(*m.Topic) + copy(dAtA[i:], *m.Topic) + i = encodeVarintLog(dAtA, i, uint64(len(*m.Topic))) + i-- + dAtA[i] = 0x1a + } + if m.Category != nil { + i -= len(*m.Category) + copy(dAtA[i:], *m.Category) + i = encodeVarintLog(dAtA, i, uint64(len(*m.Category))) + i-- + dAtA[i] = 0x12 + } + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLog(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *SlsLogPackage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlsLogPackage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SlsLogPackage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.UncompressSize != nil { + i = encodeVarintLog(dAtA, i, uint64(*m.UncompressSize)) + i-- + dAtA[i] = 0x10 + } + if m.Data == nil { + return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError) + } else { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintLog(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SlsLogPackageList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SlsLogPackageList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SlsLogPackageList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Packages) > 0 { + for iNdEx := len(m.Packages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Packages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLog(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *LogGroupList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LogGroupList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LogGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.LogGroups) > 0 { + for iNdEx := len(m.LogGroups) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LogGroups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLog(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintLog(dAtA []byte, offset int, v uint64) int { + offset -= sovLog(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *LogContent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Key != nil { + l = len(*m.Key) + n += 1 + l + sovLog(uint64(l)) + } + if m.Value != nil { + l = len(*m.Value) + n += 1 + l + sovLog(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Log) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Time != nil { + n += 1 + sovLog(uint64(*m.Time)) + } + if len(m.Contents) > 0 { + for _, e := range m.Contents { + l = e.Size() + n += 1 + l + sovLog(uint64(l)) + } + } + if m.TimeNs != nil { + n += 5 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LogTag) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Key != nil { + l = len(*m.Key) + n += 1 + l + sovLog(uint64(l)) + } + if m.Value != nil { + l = len(*m.Value) + n += 1 + l + sovLog(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LogGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovLog(uint64(l)) + } + } + if m.Category != nil { + l = len(*m.Category) + n += 1 + l + sovLog(uint64(l)) + } + if m.Topic != nil { + l = len(*m.Topic) + n += 1 + l + sovLog(uint64(l)) + } + if m.Source != nil { + l = len(*m.Source) + n += 1 + l + sovLog(uint64(l)) + } + if m.MachineUUID != nil { + l = len(*m.MachineUUID) + n += 1 + l + sovLog(uint64(l)) + } + if len(m.LogTags) > 0 { + for _, e := range m.LogTags { + l = e.Size() + n += 1 + l + sovLog(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SlsLogPackage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Data != nil { + l = len(m.Data) + n += 1 + l + sovLog(uint64(l)) + } + if m.UncompressSize != nil { + n += 1 + sovLog(uint64(*m.UncompressSize)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SlsLogPackageList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Packages) > 0 { + for _, e := range m.Packages { + l = e.Size() + n += 1 + l + sovLog(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *LogGroupList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.LogGroups) > 0 { + for _, e := range m.LogGroups { + l = e.Size() + n += 1 + l + sovLog(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovLog(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLog(x uint64) (n int) { + return sovLog(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *LogContent) Unmarshal(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LogContent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LogContent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m._key = string(dAtA[iNdEx:postIndex]) + m.Key = &m._key + iNdEx = postIndex + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m._value = string(dAtA[iNdEx:postIndex]) + m.Value = &m._value + iNdEx = postIndex + hasFields[0] |= uint64(0x00000002) + default: + iNdEx = preIndex + skippy, err := skipLog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return new(github_com_golang_protobuf_proto.RequiredNotSetError) + } + if hasFields[0]&uint64(0x00000002) == 0 { + return new(github_com_golang_protobuf_proto.RequiredNotSetError) + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Log) Unmarshal(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Log: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Log: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + } + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Time = &v + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contents = append(m.Contents, &LogContent{}) + if err := m.Contents[len(m.Contents)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeNs", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.TimeNs = &v + default: + iNdEx = preIndex + skippy, err := skipLog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return new(github_com_golang_protobuf_proto.RequiredNotSetError) + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LogTag) Unmarshal(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LogTag: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LogTag: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m._key = string(dAtA[iNdEx:postIndex]) + m.Key = &m._key + iNdEx = postIndex + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m._value = string(dAtA[iNdEx:postIndex]) + m.Value = &m._value + iNdEx = postIndex + hasFields[0] |= uint64(0x00000002) + default: + iNdEx = preIndex + skippy, err := skipLog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return new(github_com_golang_protobuf_proto.RequiredNotSetError) + } + if hasFields[0]&uint64(0x00000002) == 0 { + return new(github_com_golang_protobuf_proto.RequiredNotSetError) + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LogGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LogGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LogGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logs = append(m.Logs, &Log{}) + if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Category", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Category = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Topic = &s + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Source = &s + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MachineUUID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.MachineUUID = &s + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LogTags", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LogTags = append(m.LogTags, &LogTag{}) + if err := m.LogTags[len(m.LogTags)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlsLogPackage) Unmarshal(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlsLogPackage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlsLogPackage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + hasFields[0] |= uint64(0x00000001) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UncompressSize", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.UncompressSize = &v + default: + iNdEx = preIndex + skippy, err := skipLog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return new(github_com_golang_protobuf_proto.RequiredNotSetError) + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlsLogPackageList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SlsLogPackageList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlsLogPackageList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Packages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Packages = append(m.Packages, &SlsLogPackage{}) + if err := m.Packages[len(m.Packages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LogGroupList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LogGroupList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LogGroupList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LogGroups", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLog + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LogGroups = append(m.LogGroups, &LogGroup{}) + if err := m.LogGroups[len(m.LogGroups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLog(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthLog + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLog + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLog + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLog = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLog = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLog = fmt.Errorf("proto: unexpected end of group") +) diff --git a/alibabacloud-gateway-sls/util/golang/client/log_serializer.go b/alibabacloud-gateway-sls/util/golang/client/log_serializer.go new file mode 100644 index 00000000..9617f3e4 --- /dev/null +++ b/alibabacloud-gateway-sls/util/golang/client/log_serializer.go @@ -0,0 +1,218 @@ +package client + +import ( + "errors" + "fmt" +) + +func serializeLogGroupToPB(logGroup interface{}) ([]byte, error) { + if logGroup == nil { + return nil, errors.New("fail to serialize LogGroup to protobuf, logGroup is nil") + } + + m, ok := logGroup.(map[string]interface{}) + if !ok { + return nil, errors.New("fail to serialize LogGroup to protobuf, logGroup is not a map") + } + + lg := &LogGroup{} + + // topic + topic, err := getString(m, "Topic") + if err != nil { + return nil, err + } + if topic != "" { + lg.Topic = &topic + } + + // source + source, err := getString(m, "Source") + if err != nil { + return nil, err + } + if source != "" { + lg.Source = &source + } + + // logTags + if err := serializeLogTags(lg, m); err != nil { + return nil, err + } + + // logItems + if err := serializeLogItems(lg, m); err != nil { + return nil, err + } + + // to bytes + data, err := lg.Marshal() + if err != nil { + return nil, fmt.Errorf("fail to serialize LogGroup to protobuf, %w", err) + } + return data, nil +} + +func serializeLogItems(lg *LogGroup, logGroup map[string]interface{}) error { + logItems, ok := logGroup["LogItems"].([]interface{}) + if !ok { + return errors.New("fail to serialize LogGroup to protobuf, LogItems field is not a slice") + } + + if logItems == nil { + return nil + } + + for _, logItem := range logItems { + if err := serializeLogItem(lg, logItem); err != nil { + return err + } + } + return nil +} + +func serializeLogItem(lg *LogGroup, logItem interface{}) error { + m, ok := logItem.(map[string]interface{}) + if !ok { + return errors.New("fail to serialize LogGroup to protobuf, logItem is not a map") + } + + logPb := &Log{} + + time, exists, err := getInt64(m, "Time") + if err != nil { + return err + } + if !exists { + return errors.New("fail to serialize LogGroup to protobuf, log time is missing") + } + timeUint32 := uint32(time) + logPb.Time = &timeUint32 + + if timeNano, exists, err := getInt64(m, "TimeNs"); err != nil { + return err + } else if exists { + timeNanoUint32 := uint32(timeNano) + logPb.TimeNs = &timeNanoUint32 + } + + if err := serializeLogContents(logPb, m); err != nil { + return err + } + lg.Logs = append(lg.Logs, logPb) + return nil +} + +func serializeLogContents(logPb *Log, logItem map[string]interface{}) error { + contents, ok := logItem["Contents"].([]interface{}) + if !ok { + return errors.New("fail to serialize LogGroup to protobuf, logContents is not a slice") + } + + if contents == nil { + return nil + } + + for _, content := range contents { + if err := serializeLogContent(logPb, content); err != nil { + return err + } + } + + return nil +} + +func serializeLogContent(logPb *Log, content interface{}) error { + m, ok := content.(map[string]interface{}) + if !ok { + return errors.New("fail to serialize LogGroup to protobuf, logContent is not a map") + } + + key, value, err := getKeyValuePair(m) + if err != nil { + return err + } + + logPb.Contents = append(logPb.Contents, &LogContent{Key: &key, Value: &value}) + return nil +} + +func serializeLogTags(lg *LogGroup, logGroup map[string]interface{}) error { + logTags, ok := logGroup["LogTags"].([]interface{}) + if !ok { + return errors.New("fail to serialize LogGroup to protobuf, LogTags field is not a slice") + } + + if logTags == nil { + return nil + } + + for _, logTag := range logTags { + if err := serializeLogTag(lg, logTag); err != nil { + return err + } + } + return nil +} + +func serializeLogTag(lg *LogGroup, logTag interface{}) error { + m, ok := logTag.(map[string]interface{}) + if !ok { + return errors.New("fail to serialize LogGroup to protobuf, logTag is not a map") + } + + key, value, err := getKeyValuePair(m) + if err != nil { + return err + } + + lg.LogTags = append(lg.LogTags, &LogTag{Key: &key, Value: &value}) + return nil +} + +func getKeyValuePair(m map[string]interface{}) (key string, value string, err error) { + key, err = getString(m, "Key") + if err != nil { + return "", "", err + } + + value, err = getString(m, "Value") + if err != nil { + return "", "", err + } + + return key, value, nil +} + +func getString(m map[string]interface{}, key string) (string, error) { + v, ok := m[key] + if !ok { + return "", nil + } + + s, ok := v.(string) + if !ok { + return "", fmt.Errorf("value of %s is not a string (type: %T)", key, v) + } + return s, nil +} + +func getInt64(m map[string]interface{}, key string) (int64, bool, error) { + v, ok := m[key] + if !ok { + return 0, false, nil + } + if i, ok := v.(int64); ok { + return i, true, nil + } + + if i, ok := v.(int); ok { + return int64(i), true, nil + } + + if i, ok := v.(int32); ok { + return int64(i), true, nil + } + + return 0, false, fmt.Errorf("value of %s is not a number (type: %T, value: %v)", key, v, v) +} diff --git a/alibabacloud-gateway-sls/util/golang/go.mod b/alibabacloud-gateway-sls/util/golang/go.mod index ce2ea982..981edac8 100644 --- a/alibabacloud-gateway-sls/util/golang/go.mod +++ b/alibabacloud-gateway-sls/util/golang/go.mod @@ -5,6 +5,8 @@ go 1.19 require ( github.com/alibabacloud-go/tea v1.1.0 github.com/alibabacloud-go/tea-utils/v2 v2.0.1 + github.com/gogo/protobuf v1.3.2 + github.com/golang/protobuf v1.5.2 github.com/klauspost/compress v1.17.8 github.com/pierrec/lz4 v2.6.0+incompatible ) @@ -12,5 +14,7 @@ require ( require ( github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect github.com/frankban/quicktest v1.14.5 // indirect + github.com/google/go-cmp v0.5.9 // indirect golang.org/x/net v0.23.0 // indirect + google.golang.org/protobuf v1.26.0 // indirect ) diff --git a/alibabacloud-gateway-sls/util/golang/go.sum b/alibabacloud-gateway-sls/util/golang/go.sum index 69f3fcf8..d03bef02 100644 --- a/alibabacloud-gateway-sls/util/golang/go.sum +++ b/alibabacloud-gateway-sls/util/golang/go.sum @@ -7,8 +7,16 @@ github.com/alibabacloud-go/tea-utils/v2 v2.0.1/go.mod h1:U5MTY10WwlquGPS34DOeomU github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA= github.com/frankban/quicktest v1.14.5/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -20,11 +28,37 @@ github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= From f9b1a269c59f932ad71828e856664d078d9ba101 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 21:23:02 +0800 Subject: [PATCH 09/12] fix parse int --- .../util/golang/client/log_serializer.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/alibabacloud-gateway-sls/util/golang/client/log_serializer.go b/alibabacloud-gateway-sls/util/golang/client/log_serializer.go index 9617f3e4..e1137f88 100644 --- a/alibabacloud-gateway-sls/util/golang/client/log_serializer.go +++ b/alibabacloud-gateway-sls/util/golang/client/log_serializer.go @@ -1,6 +1,7 @@ package client import ( + "encoding/json" "errors" "fmt" ) @@ -79,7 +80,7 @@ func serializeLogItem(lg *LogGroup, logItem interface{}) error { logPb := &Log{} - time, exists, err := getInt64(m, "Time") + time, exists, err := getInt(m, "Time") if err != nil { return err } @@ -89,7 +90,7 @@ func serializeLogItem(lg *LogGroup, logItem interface{}) error { timeUint32 := uint32(time) logPb.Time = &timeUint32 - if timeNano, exists, err := getInt64(m, "TimeNs"); err != nil { + if timeNano, exists, err := getInt(m, "TimeNs"); err != nil { return err } else if exists { timeNanoUint32 := uint32(timeNano) @@ -197,11 +198,20 @@ func getString(m map[string]interface{}, key string) (string, error) { return s, nil } -func getInt64(m map[string]interface{}, key string) (int64, bool, error) { +func getInt(m map[string]interface{}, key string) (int64, bool, error) { v, ok := m[key] if !ok { return 0, false, nil } + + if i, ok := v.(json.Number); ok { + if vv, err := i.Int64(); err != nil { + return 0, false, err + } else { + return vv, true, nil + } + } + if i, ok := v.(int64); ok { return i, true, nil } From e8383ea07dfdf6cca3a1cdb0bdfaa70fa8521eaf Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Fri, 14 Nov 2025 22:12:02 +0800 Subject: [PATCH 10/12] fix --- .../util/golang/client/log_serializer.go | 61 ++++++++++++------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/alibabacloud-gateway-sls/util/golang/client/log_serializer.go b/alibabacloud-gateway-sls/util/golang/client/log_serializer.go index e1137f88..daa2a09a 100644 --- a/alibabacloud-gateway-sls/util/golang/client/log_serializer.go +++ b/alibabacloud-gateway-sls/util/golang/client/log_serializer.go @@ -4,6 +4,8 @@ import ( "encoding/json" "errors" "fmt" + + "github.com/gogo/protobuf/proto" ) func serializeLogGroupToPB(logGroup interface{}) ([]byte, error) { @@ -55,15 +57,18 @@ func serializeLogGroupToPB(logGroup interface{}) ([]byte, error) { } func serializeLogItems(lg *LogGroup, logGroup map[string]interface{}) error { - logItems, ok := logGroup["LogItems"].([]interface{}) + // check if logItems is nil, regard as empty logItems if nil + logItemsValue, ok := logGroup["LogItems"] if !ok { - return errors.New("fail to serialize LogGroup to protobuf, LogItems field is not a slice") + return nil } - if logItems == nil { - return nil + logItems, ok := logItemsValue.([]interface{}) + if !ok { + return errors.New("fail to serialize LogGroup to protobuf, LogItems field is not a slice") } + // empty logItems is valid for _, logItem := range logItems { if err := serializeLogItem(lg, logItem); err != nil { return err @@ -73,6 +78,10 @@ func serializeLogItems(lg *LogGroup, logGroup map[string]interface{}) error { } func serializeLogItem(lg *LogGroup, logItem interface{}) error { + if logItem == nil { + return errors.New("fail to serialize LogGroup to protobuf, logItem is nil") + } + m, ok := logItem.(map[string]interface{}) if !ok { return errors.New("fail to serialize LogGroup to protobuf, logItem is not a map") @@ -80,21 +89,18 @@ func serializeLogItem(lg *LogGroup, logItem interface{}) error { logPb := &Log{} - time, exists, err := getInt(m, "Time") - if err != nil { + if time, exists, err := getInt(m, "Time"); err != nil { return err - } - if !exists { + } else if !exists { return errors.New("fail to serialize LogGroup to protobuf, log time is missing") + } else { + logPb.Time = proto.Uint32(uint32(time)) } - timeUint32 := uint32(time) - logPb.Time = &timeUint32 if timeNano, exists, err := getInt(m, "TimeNs"); err != nil { return err } else if exists { - timeNanoUint32 := uint32(timeNano) - logPb.TimeNs = &timeNanoUint32 + logPb.TimeNs = proto.Uint32(uint32(timeNano)) } if err := serializeLogContents(logPb, m); err != nil { @@ -105,15 +111,17 @@ func serializeLogItem(lg *LogGroup, logItem interface{}) error { } func serializeLogContents(logPb *Log, logItem map[string]interface{}) error { - contents, ok := logItem["Contents"].([]interface{}) + // check if logContents is nil, regard as empty logContents if nil + contentsValue, ok := logItem["Contents"] if !ok { - return errors.New("fail to serialize LogGroup to protobuf, logContents is not a slice") + return errors.New("fail to serialize LogGroup to protobuf, log Contents is missing") } - - if contents == nil { - return nil + contents, ok := contentsValue.([]interface{}) + if !ok { + return errors.New("fail to serialize LogGroup to protobuf, logContents is not a slice") } + // empty logContents is valid for _, content := range contents { if err := serializeLogContent(logPb, content); err != nil { return err @@ -124,6 +132,10 @@ func serializeLogContents(logPb *Log, logItem map[string]interface{}) error { } func serializeLogContent(logPb *Log, content interface{}) error { + if content == nil { + return errors.New("fail to serialize LogGroup to protobuf, logContent is nil") + } + m, ok := content.(map[string]interface{}) if !ok { return errors.New("fail to serialize LogGroup to protobuf, logContent is not a map") @@ -139,15 +151,18 @@ func serializeLogContent(logPb *Log, content interface{}) error { } func serializeLogTags(lg *LogGroup, logGroup map[string]interface{}) error { - logTags, ok := logGroup["LogTags"].([]interface{}) + // check if logTags is nil, regard as empty logTags if nil + logTagsValue, ok := logGroup["LogTags"] if !ok { - return errors.New("fail to serialize LogGroup to protobuf, LogTags field is not a slice") + return nil } - if logTags == nil { - return nil + logTags, ok := logTagsValue.([]interface{}) + if !ok { + return errors.New("fail to serialize LogGroup to protobuf, LogTags field is not a slice") } + // empty logTags is valid for _, logTag := range logTags { if err := serializeLogTag(lg, logTag); err != nil { return err @@ -157,6 +172,10 @@ func serializeLogTags(lg *LogGroup, logGroup map[string]interface{}) error { } func serializeLogTag(lg *LogGroup, logTag interface{}) error { + if logTag == nil { + return errors.New("fail to serialize LogGroup to protobuf, logTag is nil") + } + m, ok := logTag.(map[string]interface{}) if !ok { return errors.New("fail to serialize LogGroup to protobuf, logTag is not a map") From 95720a764338384efb28775e81fe9ed09adc0747 Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Tue, 18 Nov 2025 11:54:21 +0800 Subject: [PATCH 11/12] bump teafile version --- alibabacloud-gateway-sls/Teafile | 4 ++-- alibabacloud-gateway-sls/util/Teafile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alibabacloud-gateway-sls/Teafile b/alibabacloud-gateway-sls/Teafile index f11876a3..123d5420 100644 --- a/alibabacloud-gateway-sls/Teafile +++ b/alibabacloud-gateway-sls/Teafile @@ -23,8 +23,8 @@ }, "releases": { "ts": "@alicloud/gateway-sls:^0.3.0", - "go": "github.com/alibabacloud-go/alibabacloud-gateway-sls/client:v0.3.0", - "java": "com.aliyun:alibabacloud-gateway-sls:0.3.0", + "go": "github.com/alibabacloud-go/alibabacloud-gateway-sls/client:v0.4.0", + "java": "com.aliyun:alibabacloud-gateway-sls:0.4.0", "python": "alibabacloud_gateway_sls:0.3.0", "python2": "alibabacloud_gateway_sls_py2:0.0.6", "csharp": "AlibabaCloud.GatewaySls:0.3.0", diff --git a/alibabacloud-gateway-sls/util/Teafile b/alibabacloud-gateway-sls/util/Teafile index 0c4e6941..6e4f809a 100644 --- a/alibabacloud-gateway-sls/util/Teafile +++ b/alibabacloud-gateway-sls/util/Teafile @@ -14,8 +14,8 @@ }, "releases": { "ts": "@alicloud/gateway-sls-util:^0.3.0", - "go": "github.com/alibabacloud-go/alibabacloud-gateway-sls-util/client:v0.3.0", - "java": "com.aliyun:alibabacloud-gateway-sls-util:0.3.0", + "go": "github.com/alibabacloud-go/alibabacloud-gateway-sls-util/client:v0.4.0", + "java": "com.aliyun:alibabacloud-gateway-sls-util:0.4.0", "python": "alibabacloud_gateway_sls_util:0.3.0", "python2": "alibabacloud_gateway_sls_util_py2:0.0.1", "csharp": "AlibabaCloud.GatewaySls_Util:0.3.0", From 43b299fff1c63f03606dfb9e3676d3bc8c98e98f Mon Sep 17 00:00:00 2001 From: "shuizhao.gh" Date: Tue, 18 Nov 2025 11:58:56 +0800 Subject: [PATCH 12/12] revert some changes --- alibabacloud-gateway-sls/Teafile | 4 ++-- alibabacloud-gateway-sls/golang/client/client.go | 10 +--------- alibabacloud-gateway-sls/golang/go.mod | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/alibabacloud-gateway-sls/Teafile b/alibabacloud-gateway-sls/Teafile index 123d5420..f11876a3 100644 --- a/alibabacloud-gateway-sls/Teafile +++ b/alibabacloud-gateway-sls/Teafile @@ -23,8 +23,8 @@ }, "releases": { "ts": "@alicloud/gateway-sls:^0.3.0", - "go": "github.com/alibabacloud-go/alibabacloud-gateway-sls/client:v0.4.0", - "java": "com.aliyun:alibabacloud-gateway-sls:0.4.0", + "go": "github.com/alibabacloud-go/alibabacloud-gateway-sls/client:v0.3.0", + "java": "com.aliyun:alibabacloud-gateway-sls:0.3.0", "python": "alibabacloud_gateway_sls:0.3.0", "python2": "alibabacloud_gateway_sls_py2:0.0.6", "csharp": "AlibabaCloud.GatewaySls:0.3.0", diff --git a/alibabacloud-gateway-sls/golang/client/client.go b/alibabacloud-gateway-sls/golang/client/client.go index ec14c0bf..36501395 100644 --- a/alibabacloud-gateway-sls/golang/client/client.go +++ b/alibabacloud-gateway-sls/golang/client/client.go @@ -85,15 +85,7 @@ func (client *Client) ModifyRequest(context *spi.InterceptorContext, attributeMa // get body bytes var bodyBytes []byte if !tea.BoolValue(util.IsUnset(request.Body)) { - // PutLogs - if tea.BoolValue(string_.Equals(request.Action, tea.String("PutLogs"))) { - bodyBytes, _err = sls_util.SerializeLogGroupToPB(request.Body) - if _err != nil { - return _err - } - - request.Headers["content-type"] = tea.String("application/x-protobuf") - } else if tea.BoolValue(string_.Equals(request.ReqBodyType, tea.String("json"))) || tea.BoolValue(string_.Equals(request.ReqBodyType, tea.String("formData"))) { + if tea.BoolValue(string_.Equals(request.ReqBodyType, tea.String("json"))) || tea.BoolValue(string_.Equals(request.ReqBodyType, tea.String("formData"))) { request.Headers["content-type"] = tea.String("application/json") bodyStr := util.ToJSONString(request.Body) bodyBytes = util.ToBytes(bodyStr) diff --git a/alibabacloud-gateway-sls/golang/go.mod b/alibabacloud-gateway-sls/golang/go.mod index abd6c19b..882b2546 100644 --- a/alibabacloud-gateway-sls/golang/go.mod +++ b/alibabacloud-gateway-sls/golang/go.mod @@ -10,7 +10,7 @@ require ( github.com/alibabacloud-go/darabonba-map v0.0.2 github.com/alibabacloud-go/darabonba-signature-util v0.0.7 github.com/alibabacloud-go/darabonba-string v1.0.2 - github.com/alibabacloud-go/openapi-util v0.1.1 + github.com/alibabacloud-go/openapi-util v0.1.0 github.com/alibabacloud-go/tea v1.2.3-0.20240605082020-e6e537a31150 github.com/alibabacloud-go/tea-utils/v2 v2.0.6 )