/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

syntax = "proto3";

package skywalking.v3;

option java_multiple_files = true;
option java_package = "org.apache.skywalking.apm.network.common.v3";
option csharp_namespace = "SkyWalking.NetworkProtocol.V3";
option go_package = "skywalking.apache.org/repo/goapi/collect/common/v3";

import "common/Common.proto";

// Command represents an protocol customized data when return.
//
// When the agent communicates with the OAP side using gRPC, the OAP uses Command to return the data content to the Agent.
//
// The available commands are,
// Name: ConfigurationDiscoveryCommand
// Args:
//     SerialNumber: String
//     UUID: String
//     properties: Key-value pairs rely on agent-side implementations
//
// Ref, Java agent supported configurations, https://skywalking.apache.org/docs/skywalking-java/next/en/setup/service-agent/java-agent/configuration-discovery/
//
// Name: ProfileTaskQuery
// Args:
//     SerialNumber: String
//     TaskId: String
//     EndpointName: String
//     Duration: Integer
//     MinDurationThreshold: Integer
//     DumpPeriod: Integer
//     MaxSamplingCount: Integer
//     StartTime: Date Timestamp
//     CreateTime: Date Timestamp
//
// Name: EBPFProfilingTaskQuery
// Args:
//     TaskId: String
//     ProcessId: Integer List
//     TaskUpdateTime: Date timestamp
//     TriggerType: Enum, value = FIXED_TIME
//     TargetType: Enum, value = ON_CPU, OFF_CPU or NETWORK
//     TaskStartTime: Date Timestamp
//     ExtensionConfigJSON: JSON serialization of NetworkSamplings.
//         --- NetworkSamplings ---
//         NetworkSamplings: List
//             URIRegex: String
//             MinDuration: Integer
//             When4xx: Boolean
//             When5xx: Boolean
//             Settings: Object
//                 RequireCompleteRequest: Boolean
//                 MaxRequestSize: Integer
//                 RequireCompleteResponse: Boolean
//                 MaxResponseSize: Integer
//         ------------------------
//     FixedTriggerDuration: Long
//
// Name: ContinuousProfilingPolicyQuery
// Args:
//     ServiceWithPolicyJSON: List JSON serialization of ServiceWithPolicy.
//         --- ServiceWithPolicy ---
//         ServiceName: String
//         UUID: String
//         Profiling: Multiple profiling configuration. Map
//             Key: Profiling type. Enum, value = ON_CPU, OFF_CPU, NETWORK
//             Value: Profiling policies. Map
//                 Key: Monitoring type. Enum, value = PROCESS_CPU, PROCESS_THREAD_COUNT, SYSTEM_LOAD, HTTP_ERROR_RATE, HTTP_AVG_RESPONSE_TIME
//                 Value: Policy configuration. Object.
//                     Threshold: String
//                     Period(s): Integer
//                     Count: Integer
//                     URIList: List<String>
//                     URIRegex: String
//         ---------------------------
//
// Name: ContinuousProfilingReportTask
// Args:
//     TaskId: String
message Command {
    // Use command name to distinguish different data type.
    string command = 1;
    // Data content in command.
    // The value of content needs to be serialized as string for transmission.
    //
    // Basic data type: convert as string.
    // The list of basic data: multiple data are split by ",".
    // Complex data: serialize string through json.
    repeated KeyStringValuePair args = 2;
}

// Transferring multiple Command in agent and OAP.
message Commands {
    repeated Command commands = 1;
}
