Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}
GET /v1/networkgraph/cluster/{clusterId}/externalentities
| 代码 (Code) | 消息 (Message) | 数据类型 (Datatype) |
|---|---|---|
200 |
成功的响应。(A successful response.) |
|
0 |
意外的错误响应。(An unexpected error response.) |
| 字段名称 (Field Name) | 必填 (Required) | 可为空 (Nullable) | 类型 (Type) | 描述 (Description) | 格式 (Format) |
|---|---|---|---|---|---|
端口 (port) |
长整型 (Long) |
int64 |
|||
4层协议 (l4protocol) |
L4_PROTOCOL_UNKNOWN, L4_PROTOCOL_TCP, L4_PROTOCOL_UDP, L4_PROTOCOL_ICMP, L4_PROTOCOL_RAW, L4_PROTOCOL_SCTP, L4_PROTOCOL_ANY, |
| 字段名称 (Field Name) | 必填 (Required) | 可为空 (Nullable) | 类型 (Type) | 描述 (Description) | 格式 (Format) |
|---|---|---|---|---|---|
代码 (code) |
整数 (Integer) |
int32 |
|||
消息 (message) |
字符串 (String) |
||||
细节 (details) |
ProtobufAny 列表 (List of ProtobufAny) |
更新 central/networkgraph/aggregator/aggregator.go 中的 normalizeDupNameExtSrcs(…) 方法,以适应此消息的更新。(Update normalizeDupNameExtSrcs(…) in central/networkgraph/aggregator/aggregator.go whenever this message is updated.)
| 字段名称 (Field Name) | 必填 (Required) | 可为空 (Nullable) | 类型 (Type) | 描述 (Description) | 格式 (Format) |
|---|---|---|---|---|---|
名称 (name) |
字符串 (String) |
||||
CIDR (cidr) |
字符串 (String) |
||||
默认 (default) |
布尔值 (Boolean) |
|
|||
已发现 (discovered) |
布尔值 (Boolean) |
|
Any 包含任意序列化的协议缓冲区消息以及描述序列化消息类型的 URL。(Any contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message.)
Protobuf 库提供支持,以实用程序函数或 Any 类型的附加生成方法的形式打包/解包 Any 值。(Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type.)
示例 1:在 C++ 中打包和解包消息。(Example 1: Pack and unpack a message in C++.)
Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}
示例 2:在 Java 中打包和解包消息。(Example 2: Pack and unpack a message in Java.)
Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
Example 3: Pack and unpack a message in Python.
foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ...
Example 4: Pack and unpack a message in Go
foo := &pb.Foo{...}
any, err := anypb.New(foo)
if err != nil {
...
}
...
foo := &pb.Foo{}
if err := any.UnmarshalTo(foo); err != nil {
...
}
Protobuf 库提供的 pack 方法默认使用 'type.googleapis.com/full.type.name' 作为类型 URL,而 unpack 方法仅使用类型 URL 中最后一个 '/' 后的完全限定类型名称,例如 "foo.bar.com/x/y.z" 将产生类型名称 "y.z"。(The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example "foo.bar.com/x/y.z" will yield type name "y.z".)
Any 值的 JSON 表示使用反序列化的嵌入式消息的常规表示,并添加一个包含类型 URL 的附加字段@type。示例
package google.profile;
message Person {
string first_name = 1;
string last_name = 2;
}
{
"@type": "type.googleapis.com/google.profile.Person",
"firstName": <string>,
"lastName": <string>
}
如果嵌入式消息类型是众所周知的并且具有自定义 JSON 表示,则该表示将被嵌入,并添加一个字段value,该字段除了@type字段外还包含自定义 JSON。示例(对于消息[google.protobuf.Duration][])
{
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "1.212s"
}
| 字段名称 (Field Name) | 必填 (Required) | 可为空 (Nullable) | 类型 (Type) | 描述 (Description) | 格式 (Format) |
|---|---|---|---|---|---|
@type |
字符串 (String) |
唯一标识序列化协议缓冲区消息类型的 URL/资源名称。此字符串必须包含至少一个“/”字符。URL 路径的最后一部分必须表示类型的完全限定名称(如 |
| 枚举值 |
|---|
L4_PROTOCOL_UNKNOWN |
L4_PROTOCOL_TCP |
L4_PROTOCOL_UDP |
L4_PROTOCOL_ICMP |
L4_PROTOCOL_RAW |
L4_PROTOCOL_SCTP |
L4_PROTOCOL_ANY |
| 字段名称 (Field Name) | 必填 (Required) | 可为空 (Nullable) | 类型 (Type) | 描述 (Description) | 格式 (Format) |
|---|---|---|---|---|---|
信息 |
|||||
范围 |
| 字段名称 (Field Name) | 必填 (Required) | 可为空 (Nullable) | 类型 (Type) | 描述 (Description) | 格式 (Format) |
|---|---|---|---|---|---|
类型 |
UNKNOWN_TYPE, DEPLOYMENT, INTERNET, LISTEN_ENDPOINT, EXTERNAL_SOURCE, INTERNAL_ENTITIES, |
||||
ID |
字符串 (String) |
||||
部署 |
|||||
外部来源 |
| 字段名称 (Field Name) | 必填 (Required) | 可为空 (Nullable) | 类型 (Type) | 描述 (Description) | 格式 (Format) |
|---|---|---|---|---|---|
名称 (name) |
字符串 (String) |
||||
命名空间 |
字符串 (String) |
||||
集群 |
字符串 (String) |
||||
监听端口 |
INTERNAL_ENTITIES:INTERNAL_ENTITIES 用于将所有内部实体分组到单个网络图节点下
| 枚举值 |
|---|
UNKNOWN_TYPE |
DEPLOYMENT |
INTERNET |
LISTEN_ENDPOINT |
EXTERNAL_SOURCE |
INTERNAL_ENTITIES |
| 字段名称 (Field Name) | 必填 (Required) | 可为空 (Nullable) | 类型 (Type) | 描述 (Description) | 格式 (Format) |
|---|---|---|---|---|---|
集群ID (clusterId) |
字符串 (String) |