初始化

This commit is contained in:
2025-12-11 11:39:02 +08:00
commit 156d6ccb06
1708 changed files with 1162911 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
using Aliyun.Api.LOG.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aliyun.Api.LOG.Request
{
public class BatchGetLogsRequest: LogStoreRequest
{
private int _shard;
private int _count;
private String _cursor;
public int Shard
{
get { return _shard; }
set { _shard = value; }
}
public int Count
{
get { return _count; }
set { _count = value; }
}
public String Cursor
{
get { return _cursor; }
set { _cursor = value; }
}
public BatchGetLogsRequest(String project, String logstore, int shard, String cursor, int count)
: base(project, logstore)
{
Shard = shard;
Cursor = cursor;
Count = count;
}
override public void AddSpecParamsTo(IDictionary<String, String> dic)
{
dic.Add("type", "log");
dic.Add("cursor", Cursor);
dic.Add("count", _count.ToString());
}
override public void AddSpecHeadersTo(IDictionary<String, String> dic)
{
dic.Add(LogConsts.NAME_HEADER_ACCEPT_ENCODING, LogConsts.VALUE_HEADER_COMPRESSTYPE_LZ4);
dic.Add(LogConsts.NAME_HEADER_ACCEPT, LogConsts.PBVALUE_HEADER_CONTENTTYPE);
}
}
}

View File

@@ -0,0 +1,65 @@
using Aliyun.Api.LOG.Request;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aliyun.Api.LOG.Request
{
public enum ShardCursorMode
{
BEGIN, END
};
public class GetCursorRequest : LogStoreRequest
{
private int _shard;
private ShardCursorMode? _cursorMode;
private uint? _cursorTime;
public int Shard
{
get { return _shard; }
set { _shard = value; }
}
public ShardCursorMode CursorMode
{
get { return _cursorMode ?? default(ShardCursorMode); }
set { _cursorMode = value; }
}
public bool IsSetCursorMode()
{
return _cursorMode.HasValue;
}
public uint CursorTime
{
get { return _cursorTime ?? default(uint); }
set { _cursorTime = value; }
}
public GetCursorRequest(String project, String logstore, int shard, ShardCursorMode mode)
: base(project, logstore)
{
Shard = shard;
CursorMode = mode;
}
public GetCursorRequest(String project, String logstore, int shard, uint time)
: base(project, logstore)
{
Shard = shard;
CursorTime = time;
}
override public void AddSpecParamsTo(IDictionary<String, String> dic)
{
dic.Add("type", "cursor");
if (IsSetCursorMode())
{
dic.Add("from", CursorMode == ShardCursorMode.BEGIN ? "begin" : "end");
}
else
{
dic.Add("from", _cursorTime.ToString());
}
}
override public void AddSpecHeadersTo(IDictionary<String, String> dic)
{
}
}
}

View File

@@ -0,0 +1,140 @@
/*
* Copyright (C) Alibaba Cloud Computing
* All rights reserved.
*
* 版权所有 C阿里云计算有限公司
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aliyun.Api.LOG.Request
{
/// <summary>
/// The Request used to get histograms of a query from sls server
/// </summary>
public class GetHistogramsRequest : LogRequest
{
private String _logstore;
private String _topic;
private uint? _from;
private uint? _to;
private String _query;
/// <summary>
/// default constructor.
/// please set required fileds(project, logstore, from, to) initialized by this default constructor before
/// using it to send request. Otherwise, request will be failed with exception.
/// </summary>
public GetHistogramsRequest()
{
}
/// <summary>
/// constructor with all required fileds
/// </summary>
/// <param name="project">project name</param>
/// <param name="logstore">logstore name</param>
/// <param name="from">begin timestamp of time range to query</param>
/// <param name="to">end timestamp of time range to query</param>
public GetHistogramsRequest(String project, String logstore, uint from, uint to)
:base(project)
{
_logstore = logstore;
_from = from;
_to = to;
}
/// <summary>
/// constructor with all possible fileds
/// </summary>
/// <param name="project">project name</param>
/// <param name="logstore">logstore name</param>
/// <param name="from">begin timestamp of time range to query</param>
/// <param name="to">end timestamp of time range to query</param>
/// <param name="topic">log topic to query</param>
/// <param name="query">query string to run</param>
public GetHistogramsRequest(String project, String logstore, uint from, uint to, String topic, String query)
:base(project)
{
_logstore = logstore;
_from = from;
_to = to;
_topic = topic;
_query = query;
}
/// <summary>
/// The logstore name
/// </summary>
public String Logstore
{
get { return _logstore; }
set { _logstore = value; }
}
internal bool IsSetLogstore()
{
return _logstore != null;
}
/// <summary>
/// The log topic to query
/// </summary>
public String Topic
{
get { return _topic; }
set { _topic = value; }
}
internal bool IsSetTopic()
{
return _topic != null;
}
/// <summary>
/// The begin timestamp of time range to query
/// </summary>
public uint From
{
get { return _from ?? default(uint); }
set { _from = value; }
}
internal bool IsSetFrom()
{
return _from.HasValue;
}
/// <summary>
/// The end timestamp of time range to query
/// </summary>
public uint To
{
get { return _to ?? default(uint); }
set { _to = value; }
}
internal bool IsSetTo()
{
return _to.HasValue;
}
/// <summary>
/// The query string to run
/// </summary>
public String Query
{
get { return _query; }
set { _query = value; }
}
internal bool IsSetQuery()
{
return _query != null;
}
}
}

View File

@@ -0,0 +1,193 @@
/*
* Copyright (C) Alibaba Cloud Computing
* All rights reserved.
*
* 版权所有 C阿里云计算有限公司
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aliyun.Api.LOG.Request
{
/// <summary>
/// The Request used to get data of a query from sls server
/// </summary>
public class GetLogsRequest : LogRequest
{
private String _logstore;
private String _topic;
private uint? _from;
private uint? _to;
private String _query;
private int? _lines;
private long? _offset;
private bool? _reverse;
/// <summary>
/// default constructor.
/// please set required fileds(project, logstore, from, to) initialized by this default constructor before
/// using it to send request. Otherwise, request will be failed with exception.
/// </summary>
public GetLogsRequest()
{
}
/// <summary>
/// constructor with all required fileds
/// </summary>
/// <param name="project">project name</param>
/// <param name="logstore">logstore name</param>
/// <param name="from">begin timestamp of time range to query</param>
/// <param name="to">end timestamp of time range to query</param>
public GetLogsRequest(String project, String logstore, uint from, uint to)
:base(project)
{
_logstore = logstore;
_from = from;
_to = to;
}
/// <summary>
/// constructor with all possible fileds
/// </summary>
/// <param name="project">project name</param>
/// <param name="logstore">logstore name</param>
/// <param name="from">begin timestamp of time range to query</param>
/// <param name="to">end timestamp of time range to query</param>
/// <param name="topic">log topic to query</param>
/// <param name="query">query string to run</param>
/// <param name="lines">count of logs to request</param>
/// <param name="offset">offset of logs to request</param>
/// <param name="reverse">flag indicates whether logs in response are in reversed order</param>
public GetLogsRequest(String project, String logstore, uint from, uint to, String topic, String query,
int lines, int offset, bool reverse)
:base(project)
{
_logstore = logstore;
_from = from;
_to = to;
_topic = topic;
_query = query;
_lines = lines;
_offset = offset;
_reverse = reverse;
}
/// <summary>
/// The logstore name
/// </summary>
public String Logstore
{
get { return _logstore; }
set { _logstore = value; }
}
internal bool IsSetLogstore()
{
return _logstore != null;
}
/// <summary>
/// The log topic to query
/// </summary>
public String Topic
{
get { return _topic; }
set { _topic = value; }
}
internal bool IsSetTopic()
{
return _topic != null;
}
/// <summary>
/// The begin timestamp of time range to query
/// </summary>
public uint From
{
get { return _from ?? default(uint); }
set { _from = value; }
}
internal bool IsSetFrom()
{
return _from.HasValue;
}
/// <summary>
/// The end timestamp of time range to query
/// </summary>
public uint To
{
get { return _to ?? default(uint); }
set { _to = value; }
}
internal bool IsSetTo()
{
return _to.HasValue;
}
/// <summary>
/// The query string to run
/// </summary>
public String Query
{
get { return _query; }
set { _query = value; }
}
internal bool IsSetQuery()
{
return _query != null;
}
/// <summary>
/// The count of logs to request
/// </summary>
public int Lines
{
get { return _lines ?? default(int); }
set { _lines = value; }
}
internal bool IsSetLines()
{
return _lines.HasValue;
}
/// <summary>
/// The offset of logs to request
/// </summary>
public long Offset
{
get { return _offset ?? default(long); }
set { _offset = value; }
}
internal bool IsSetOffset()
{
return _offset.HasValue;
}
/// <summary>
/// flag of logs' order int response.
/// If reverse is true, the query will return the latest logs.
/// </summary>
public bool Reverse
{
get { return _reverse ?? false; }
set { _reverse = value; }
}
internal bool IsSetReverse()
{
return _reverse.HasValue;
}
}
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) Alibaba Cloud Computing
* All rights reserved.
*
* 版权所有 C阿里云计算有限公司
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aliyun.Api.LOG.Request
{
/// <summary>
/// The request used to list log store from sls server
/// </summary>
public class ListLogstoresRequest : LogRequest
{
/// <summary>
/// default constructor
/// </summary>
public ListLogstoresRequest()
{
}
/// <summary>
/// constructor with project name
/// </summary>
/// <param name="project">project name</param>
public ListLogstoresRequest(String project): base(project){
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aliyun.Api.LOG.Request
{
public class ListShardsRequest: LogStoreRequest
{
public ListShardsRequest(String projrct, String logstore)
: base(projrct, logstore)
{
}
override public void AddSpecParamsTo(IDictionary<String, String> dic)
{
}
override public void AddSpecHeadersTo(IDictionary<String, String> dic)
{
}
}
}

View File

@@ -0,0 +1,102 @@
/*
* Copyright (C) Alibaba Cloud Computing
* All rights reserved.
*
* 版权所有 C阿里云计算有限公司
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aliyun.Api.LOG.Request
{
/// <summary>
/// The request used to list topic from sls server
/// </summary>
public class ListTopicsRequest : LogRequest
{
private String _logstore;
private String _token;
private int? _lines;
/// <summary>
/// default constructor.
/// please set required fileds(project, logstore) initialized by this default constructor before using it to
/// send request. Otherwise, request will be failed with exception.
/// </summary>
public ListTopicsRequest()
{
}
/// <summary>
/// constructor with all required fileds
/// </summary>
/// <param name="project">project name</param>
/// <param name="logstore">logstore name</param>
public ListTopicsRequest(String project, String logstore)
:base(project)
{
_logstore = logstore;
}
/// <summary>
/// constructor with all possible fileds
/// </summary>
/// <param name="project">project name</param>
/// <param name="logstore">logstore name</param>
/// <param name="token">token to list more topics</param>
/// <param name="lines">count of topics to request</param>
public ListTopicsRequest(String project, String logstore, String token, Int32 lines)
:base(project)
{
_logstore = logstore;
_token = token;
_lines = lines;
}
/// <summary>
/// The logstore name
/// </summary>
public String Logstore
{
get { return _logstore; }
set { _logstore = value; }
}
internal bool IsSetLogstore()
{
return _logstore != null;
}
/// <summary>
/// The token to list more topics
/// </summary>
public String Token
{
get { return _token; }
set { _token = value; }
}
internal bool IsSetToken()
{
return _token != null;
}
/// <summary>
/// The count of topics to request
/// </summary>
public int Lines
{
get { return _lines ?? default(int); }
set { _lines = value; }
}
internal bool IsSetLines()
{
return _lines.HasValue;
}
}
}

View File

@@ -0,0 +1,29 @@
using Aliyun.Api.LOG.Request;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aliyun.Api.LOG.Request
{
public abstract class LogStoreRequest : LogRequest
{
private String _logstore;
/// <summary>
/// The logstore name
/// </summary>
public String Logstore
{
get { return _logstore; }
set { _logstore = value; }
}
public LogStoreRequest(String project, String logstore)
: base(project)
{
Logstore = logstore;
}
abstract public void AddSpecParamsTo(IDictionary<String, String> dic);
abstract public void AddSpecHeadersTo(IDictionary<String, String> dic);
}
}

View File

@@ -0,0 +1,121 @@
/*
* Copyright (C) Alibaba Cloud Computing
* All rights reserved.
*
* 版权所有 C阿里云计算有限公司
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aliyun.Api.LOG.Data;
namespace Aliyun.Api.LOG.Request
{
/// <summary>
/// The request used to send data to sls server
/// Note: if source is not set explicitly, machine's local private ip is used
/// </summary>
public class PutLogsRequest : LogRequest
{
private String _logstore;
private String _topic;
private String _source;
private List<LogItem> _logItems;
/// <summary>
/// default constructor.
/// please set required fileds(project, logstore) initialized by this default constructor before
/// using it to send request. Otherwise, request will be failed with exception.
/// </summary>
public PutLogsRequest()
{
}
/// <summary>
/// constructor with all required fileds
/// </summary>
/// <param name="project">project name</param>
/// <param name="logstore">logstore name</param>
public PutLogsRequest(String project, String logstore)
: base(project)
{
_logstore = logstore;
}
/// <summary>
/// constructor with all possilbe fileds
/// </summary>
/// <param name="project">project name</param>
/// <param name="logstore">logstore name</param>
/// <param name="topic">log topic</param>
/// <param name="source">log source</param>
/// <param name="items">log data</param>
public PutLogsRequest(String project, String logstore, String topic, String source, List<LogItem> items)
:base(project)
{
_logstore = logstore;
_topic = topic;
_source = source;
_logItems = items;
}
/// <summary>
/// The logstore name
/// </summary>
public String Logstore
{
get { return _logstore; }
set { _logstore = value; }
}
internal bool IsSetLogstore()
{
return _logstore != null;
}
/// <summary>
/// The log topic
/// </summary>
public String Topic
{
get { return _topic; }
set { _topic = value; }
}
internal bool IsSetTopic()
{
return _topic != null;
}
/// <summary>
/// The log source
/// </summary>
public String Source
{
get { return _source; }
set { _source = value; }
}
internal bool IsSetSource()
{
return _source != null;
}
/// <summary>
/// List of logs
/// </summary>
public List<LogItem> LogItems
{
get { return _logItems; }
set { _logItems = value; }
}
internal bool IsSetLogItems()
{
return _logItems != null;
}
}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) Alibaba Cloud Computing
* All rights reserved.
*
* 版权所有 C阿里云计算有限公司
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aliyun.Api.LOG.Request
{
/// <summary>
/// Super class of all request
/// </summary>
public class LogRequest
{
private String _project;
/// <summary>
/// default constructor of SLS Request.
/// </summary>
public LogRequest()
{
}
/// <summary>
/// LogRequest constructor with project name.
/// </summary>
/// <param name="project">project name to do SLS Request</param>
public LogRequest(String project)
{
_project = project;
}
/// <summary>
/// project name of the request
/// </summary>
public String Project
{
get { return _project; }
set { _project = value; }
}
internal bool IsSetProject()
{
return _project != null;
}
}
}