├── .gitattribute ├── .gitignore ├── .travis.yml ├── Aliyun.Api.LogService.Benchmark ├── Aliyun.Api.LogService.Benchmark.csproj ├── DefaultLogServiceClientBenchmark.cs └── Program.cs ├── Aliyun.Api.LogService.Examples ├── Aliyun.Api.LogService.Examples.csproj ├── ApiUsage │ ├── PostLogStoreLogsExample.cs │ └── PullLogsExample.cs ├── BuildClient │ ├── BuildClientExample.cs │ └── BuildClientUsingStsTokenExample.cs ├── DependencyInjection │ ├── AutofacExample.cs │ └── NinjectModuleExample.cs ├── Invocation │ ├── InvokeAsyncExample.cs │ ├── InvokeSyncExample.cs │ └── InvokeUsingTplExample.cs └── Program.cs ├── Aliyun.Api.LogService.Tests ├── Aliyun.Api.LogService.Tests.csproj ├── DefaultLogServiceClientTests.cs ├── Infrastruture │ └── Protocol │ │ └── ErrorCodeTests.cs ├── NetworkPressureTests.cs ├── ProjectSwitchTests.cs ├── StsTokenAccessTest.cs └── TestUtils │ ├── TestContextFixture.cs │ ├── TestPriorityAttribute.cs │ └── TestPriorityOrderer.cs ├── Aliyun.Api.LogService ├── Aliyun.Api.LogService.csproj ├── Domain │ ├── Config │ │ ├── ConfigInputDetailInfo.cs │ │ ├── ConfigOutputDetailInfo.cs │ │ ├── CreateConfigRequest.cs │ │ ├── DeleteConfigRequest.cs │ │ ├── GetAppliedMachineGroupsRequest.cs │ │ ├── GetAppliedMachineGroupsResult.cs │ │ ├── GetConfigRequest.cs │ │ ├── GetConfigResult.cs │ │ ├── ListConfigRequest.cs │ │ ├── ListConfigResult.cs │ │ └── UpdateConfigRequest.cs │ ├── Log │ │ ├── GetLogHistogramsRequest.cs │ │ ├── GetLogHistogramsResult.cs │ │ ├── GetLogsRequest.cs │ │ ├── GetLogsResult.cs │ │ ├── GetProjectLogsRequest.cs │ │ ├── LogGroupInfo.cs │ │ ├── LogHistogramInfo.cs │ │ ├── LogInfo.cs │ │ ├── LogProgressState.cs │ │ ├── LogQueryInfo.cs │ │ ├── PostLogsRequest.cs │ │ ├── PullLogsRequest.cs │ │ └── PullLogsResult.cs │ ├── LogServiceException.cs │ ├── LogStore │ │ ├── CreateLogStoreRequest.cs │ │ ├── DeleteLogStoreRequest.cs │ │ ├── GetLogStoreRequest.cs │ │ ├── GetLogStoreResult.cs │ │ ├── Index │ │ │ ├── CreateIndexRequest.cs │ │ │ ├── IndexKeyInfo.cs │ │ │ ├── IndexKeysBuilder.cs │ │ │ └── IndexLineInfo.cs │ │ ├── ListLogStoreRequest.cs │ │ ├── ListLogStoreResult.cs │ │ ├── Shard │ │ │ ├── GetCursorRequest.cs │ │ │ ├── GetCursorResult.cs │ │ │ ├── ListShardRequest.cs │ │ │ ├── MergeShardRequest.cs │ │ │ ├── ShardInfo.cs │ │ │ ├── ShardState.cs │ │ │ └── SplitShardRequest.cs │ │ ├── Shipper │ │ │ ├── GetShipperRequest.cs │ │ │ ├── GetShipperResult.cs │ │ │ └── RetryShipperRequest.cs │ │ └── UpdateLogStoreRequest.cs │ ├── MachineGroup │ │ ├── ApplyConfigToMachineGroupRequest.cs │ │ ├── CreateMachineGroupRequest.cs │ │ ├── DeleteMachineGroupRequest.cs │ │ ├── GetAppliedConfigsRequest.cs │ │ ├── GetAppliedConfigsResult.cs │ │ ├── GetMachineGroupRequest.cs │ │ ├── GetMachineGroupResult.cs │ │ ├── ListMachineGroupRequest.cs │ │ ├── ListMachineGroupResult.cs │ │ ├── ListMachinesRequest.cs │ │ ├── ListMachinesResult.cs │ │ ├── MachineGroupAttributeInfo.cs │ │ ├── RemoveConfigFromMachineGroupRequest.cs │ │ └── UpdateMachineGroupRequest.cs │ └── Project │ │ ├── CreateProjectRequest.cs │ │ ├── DeleteProjectRequest.cs │ │ ├── GetProjectRequest.cs │ │ ├── GetProjectResult.cs │ │ ├── ListProjectRequest.cs │ │ ├── ListProjectResult.cs │ │ ├── ProjectDetailInfo.cs │ │ ├── ProjectInfo.cs │ │ ├── ProjectScopedRequest.cs │ │ └── ProjectState.cs ├── ILogServiceClient.cs ├── Infrastructure │ ├── Authentication │ │ └── Credential.cs │ ├── Protocol │ │ ├── CompressType.cs │ │ ├── Error.cs │ │ ├── ErrorCode.cs │ │ ├── Http │ │ │ ├── HttpLogServiceClient.cs │ │ │ ├── HttpLogServiceClientBuilder.cs │ │ │ ├── HttpRequestMessageBuilder.cs │ │ │ ├── HttpResponse.cs │ │ │ ├── HttpResponseExtensions.cs │ │ │ ├── HttpResponseMessageResolver.cs │ │ │ ├── LogHeaderExtensions.cs │ │ │ └── LogHeaders.cs │ │ ├── IRequestBuilder.cs │ │ ├── IResponse.cs │ │ ├── IResponseResolver.cs │ │ ├── SerializeType.cs │ │ └── SignatureType.cs │ └── Serialization │ │ └── Protobuf │ │ ├── Log.Generated.cs │ │ ├── Log.proto │ │ └── LogExtensions.cs ├── LogServiceClientBuilders.cs ├── LogServiceClientExtensions.cs ├── Properties │ └── AssemblyInfo.cs └── Utils │ ├── CommonExtensions.cs │ ├── Constants.cs │ └── Ensure.cs ├── CHANGELOG.md ├── CONTRIBUTE.md ├── LICENSE ├── README.md ├── aliyun-log-dotnetcore-sdk.sln ├── aliyun-log-dotnetcore-sdk.sln.DotSettings ├── aliyun-log-dotnetcore-sdk.snk └── docs └── put-docs-here /.gitattribute: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize encoding and line endings. 3 | ############################################################################### 4 | * text encoding=UTF-8 eol=lf 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | 3 | solution: aliyun-log-dotnetcore-sdk.sln 4 | mono: none 5 | dotnet: 2.1.401 6 | 7 | install: 8 | - dotnet restore 9 | script: 10 | - dotnet clean 11 | - dotnet build -c Release 12 | - dotnet test -c Release -v detailed --filter "Skip!=true" Aliyun.Api.LogService.Tests/Aliyun.Api.LogService.Tests.csproj 13 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Benchmark/Aliyun.Api.LogService.Benchmark.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | netcoreapp2.0 4 | false 5 | Exe 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Benchmark/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Program.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using BenchmarkDotNet.Running; 29 | 30 | namespace Aliyun.Api.LogService.Benchmark 31 | { 32 | public static class Program 33 | { 34 | public static void Main(String[] args) 35 | { 36 | BenchmarkRunner.Run(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/Aliyun.Api.LogService.Examples.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Exe 4 | netcoreapp2.0 5 | 7.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/ApiUsage/PostLogStoreLogsExample.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PostLogStoreLogsExample.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Linq; 29 | using System.Threading.Tasks; 30 | using Aliyun.Api.LogService.Domain.Log; 31 | 32 | namespace Aliyun.Api.LogService.Examples.ApiUsage 33 | { 34 | public static class PostLogStoreLogsExample 35 | { 36 | private static readonly String LogStoreName = "example-logstore"; 37 | 38 | public static async Task PostLogStoreLogs(ILogServiceClient client) 39 | { 40 | // 原始日志 41 | var rawLogs = new[] 42 | { 43 | "2018-05-04 12:34:56 INFO id=1 status=foo", 44 | "2018-05-04 12:34:57 INFO id=2 status=bar", 45 | "2018-05-04 12:34:58 INFO id=1 status=foo", 46 | "2018-05-04 12:34:59 WARN id=1 status=foo", 47 | }; 48 | 49 | // 解释 LogInfo 50 | var parsedLogs = rawLogs 51 | .Select(x => 52 | { 53 | var components = x.Split(' '); 54 | 55 | var date = components[0]; 56 | var time = components[1]; 57 | var level = components[2]; 58 | var id = components[3].Split('='); 59 | var status = components[4].Split('='); 60 | 61 | var logInfo = new LogInfo 62 | { 63 | Contents = 64 | { 65 | {"level", level}, 66 | {id[0], id[1]}, 67 | {status[0], status[1]}, 68 | }, 69 | Time = DateTimeOffset.ParseExact($"{date} {time}", "yyyy-MM-dd HH:mm:ss", null) 70 | }; 71 | 72 | return logInfo; 73 | }) 74 | .ToList(); 75 | 76 | var logGroupInfo = new LogGroupInfo 77 | { 78 | Topic = "example", 79 | Source = "test", 80 | LogTags = 81 | { 82 | {"example", "true"}, 83 | }, 84 | Logs = parsedLogs 85 | }; 86 | 87 | var response = await client.PostLogStoreLogsAsync(LogStoreName, logGroupInfo); 88 | 89 | // 此接口没有返回结果,确保返回结果成功即可。 90 | response.EnsureSuccess(); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/ApiUsage/PullLogsExample.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PullLogsExample.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using System.Threading.Tasks; 31 | using Aliyun.Api.LogService.Domain.Log; 32 | using Aliyun.Api.LogService.Infrastructure.Protocol.Http; 33 | 34 | namespace Aliyun.Api.LogService.Examples.ApiUsage 35 | { 36 | public static class PullLogsExample 37 | { 38 | private static readonly String LogStoreName = "example-logstore"; 39 | 40 | public static async Task> PullLogs(ILogServiceClient client) 41 | { 42 | // 获取ShardId 43 | var listShardsResponse = await client.ListShardsAsync(LogStoreName); 44 | var listShardsResult = listShardsResponse.EnsureSuccess().Result; 45 | var shardId = listShardsResult.First().ShardId; 46 | 47 | // 获取游标 48 | var getCursorRsponse = await client.GetCursorAsync(LogStoreName, shardId, "begin"); 49 | var getCursorResult = getCursorRsponse.EnsureSuccess().Result; 50 | var cursor = getCursorResult.Cursor; 51 | 52 | // 在指定分片(shard)上从游标(cursor)开始位置获取100条日志 53 | var response = await client.PullLogsAsync(LogStoreName, shardId, cursor, 100); 54 | var result = response.EnsureSuccess().Result; 55 | 56 | // 获取Header上的下一条游标(cursor)位置 57 | var nextCursor = response.GetLogCursor(); 58 | 59 | return result.LogGroups 60 | .SelectMany(x => x.Logs); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/BuildClient/BuildClientExample.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BuildClientExample.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System.Net.Http; 28 | using Aliyun.Api.LogService.Infrastructure.Authentication; 29 | using Aliyun.Api.LogService.Infrastructure.Protocol.Http; 30 | 31 | namespace Aliyun.Api.LogService.Examples.BuildClient 32 | { 33 | public static class BuildClientExample 34 | { 35 | /**************************************************************** 36 | * `ILogServiceClient` 所有成员是线程安全的,建议使用Singleton模式。 * 37 | ****************************************************************/ 38 | 39 | // 构建最简单的`ILogServiceClient`。 40 | public static ILogServiceClient BuildSimpleClient() 41 | => LogServiceClientBuilders.HttpBuilder 42 | // 服务入口及项目名 43 | .Endpoint("", "") 44 | // 访问密钥信息 45 | .Credential("", "") 46 | .Build(); 47 | 48 | // 构建完整的`ILogServiceClient`。 49 | public static ILogServiceClient BuildFullClient() 50 | => LogServiceClientBuilders.HttpBuilder 51 | // 服务入口及项目名。 52 | .Endpoint("", "") 53 | // 访问密钥信息。 54 | .Credential("", "") 55 | // 设置每次请求超时时间。 56 | .RequestTimeout(1000) 57 | // 设置是否使用代理,为false时将会绕过系统代理。 58 | .UseProxy(true) 59 | // 设置代理信息,(可选)支持需要身份验证的代理设置。 60 | .Proxy("", proxyUserName: "", proxyPassword: "") 61 | .Build(); 62 | 63 | // 构建自定义的`ILogServiceClient`。 64 | public static ILogServiceClient BuildCustomClient() 65 | => new HttpLogServiceClient 66 | ( 67 | // 支持自定义HttpClient实例 68 | new HttpClient(), 69 | // 访问密钥信息。 70 | () => new Credential("", "") 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/BuildClient/BuildClientUsingStsTokenExample.cs: -------------------------------------------------------------------------------- 1 | // 2 | // BuildClientUsingStsTokenExample.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Timers; 29 | using Aliyun.Api.LogService.Infrastructure.Authentication; 30 | 31 | namespace Aliyun.Api.LogService.Examples.BuildClient 32 | { 33 | public static class BuildClientUsingStsTokenExample 34 | { 35 | private static readonly CredentialHolder Holder = new CredentialHolder(); 36 | 37 | /// 38 | /// 创建一个使用 STS Token 的 Client 。 39 | /// 40 | public static ILogServiceClient BuildClientUsingStsToken() 41 | { 42 | var client = LogServiceClientBuilders.HttpBuilder 43 | // 服务入口及项目名 44 | .Endpoint("", "") 45 | // 服务凭据 46 | // 请注意此处提供的是委托,而非变量,此委托会在**每次执行**时被调用,请务必注意性能问题! 47 | .Credential(() => Holder.Credential) 48 | .Build(); 49 | 50 | // 在 Client 创建完成后,务必保留定时任务以便定时刷新 Credential 。 51 | 52 | return client; 53 | } 54 | 55 | /// 56 | /// 凭据的定时刷新器。 57 | /// 58 | private class CredentialHolder : IDisposable 59 | { 60 | private readonly Timer timer; 61 | 62 | internal Credential Credential { get; private set; } 63 | 64 | public CredentialHolder() 65 | { 66 | // 由于 STS Token 时效性短,需要定时刷新。 67 | this.timer = new Timer(TimeSpan.FromMinutes(10).TotalMilliseconds); // 每10分钟执行 68 | this.timer.Elapsed += (sender, args) => this.Refresh(); // 定时执行的任务 69 | this.timer.Start(); 70 | } 71 | 72 | /// 73 | /// 刷新凭据。 74 | /// 75 | public void Refresh() 76 | { 77 | // 从 STS 服务获取凭据信息,此调用假定有返回值时总是成功,在失败时抛出异常。 78 | var (accessKeyId, accessKey, stsToken) = this.AssumeRoleOrThrow(); 79 | 80 | // 更新服务凭据 81 | this.Credential = new Credential(accessKeyId, accessKey, stsToken); 82 | } 83 | 84 | /// 85 | /// 获取远程凭据,例子中未实现。 86 | /// 此调用假定有返回值时总是成功,在失败时抛出异常 87 | /// 88 | /// STS API 参考 89 | /// STS SDK 参考 90 | private (String accessKeyId, String accessKey, String stsToken) AssumeRoleOrThrow() 91 | { 92 | throw new NotImplementedException(); 93 | } 94 | 95 | public void Dispose() 96 | { 97 | this.timer?.Dispose(); 98 | } 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/DependencyInjection/AutofacExample.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AutofacExample.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using Autofac; 28 | 29 | namespace Aliyun.Api.LogService.Examples.DependencyInjection 30 | { 31 | public static class AutofacExample 32 | { 33 | public static void Register(ContainerBuilder containerBuilder) 34 | { 35 | containerBuilder 36 | .Register(context => LogServiceClientBuilders.HttpBuilder 37 | // 服务入口及项目名 38 | .Endpoint("", "") 39 | // 访问密钥信息 40 | .Credential("", "") 41 | .Build()) 42 | // `ILogServiceClient`所有成员是线程安全的,建议使用Singleton模式。 43 | .SingleInstance(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/DependencyInjection/NinjectModuleExample.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NinjectModuleExample.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using Ninject.Modules; 28 | 29 | namespace Aliyun.Api.LogService.Examples.DependencyInjection 30 | { 31 | public class NinjectModuleExample : NinjectModule 32 | { 33 | public override void Load() 34 | { 35 | this.Bind() 36 | .ToMethod(ctx => LogServiceClientBuilders.HttpBuilder 37 | // 服务入口及项目名 38 | .Endpoint("", "") 39 | // 访问密钥信息 40 | .Credential("", "") 41 | .Build()) 42 | // `ILogServiceClient`所有成员是线程安全的,建议使用Singleton模式。 43 | .InSingletonScope(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/Invocation/InvokeSyncExample.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InvokeSyncExample.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Linq; 29 | using Aliyun.Api.LogService.Domain.Log; 30 | 31 | namespace Aliyun.Api.LogService.Examples.Invocation 32 | { 33 | public static class InvokeSyncExample 34 | { 35 | /// 36 | /// 使用同步阻塞方式获取结果。 37 | /// 38 | public static GetLogsResult InvokeSynchronously(ILogServiceClient client) 39 | { 40 | var asyncTask = client.GetLogsAsync 41 | ( 42 | // 「必填参数」作为方法的普通必须参数 43 | "example-logstore", 44 | DateTimeOffset.UtcNow.AddDays(-1), 45 | DateTimeOffset.UtcNow, 46 | 47 | // 「可选参数」作为方法的可选参数,可通过命名参数方式指定 48 | offset: 1, 49 | line: 10 50 | ); 51 | 52 | #if ASPNET || WINFORM 53 | 54 | // NOTE: 55 | // 需要注意的是,在 WinForm/ASP.NET 环境中,由于设置了 SynchronizationContext , 56 | // 所有异步后续操作(Continuation)都会被回传到调用线程上执行,此时不能直接阻塞请求,否则会造成当前线程无限等待。 57 | // See: http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html 58 | 59 | // 在上述环境中,需要使用同步调用,必须在另一线程中等待异步任务的结果。 60 | var waitTask = Task.Run(() => asyncTask.Result); 61 | var response = waitTask.Result; 62 | 63 | #else 64 | 65 | // 在普通控制台的环境下同步等待结果直接调用即可。 66 | var response = asyncTask.Result; 67 | 68 | #endif 69 | 70 | var result = response 71 | // 此方法会确保返回的响应失败时候抛出`LogServiceException`。 72 | .EnsureSuccess() 73 | // 此处获取Result是安全的。 74 | .Result; 75 | 76 | Console.WriteLine($"RequestId:{response.RequestId}"); 77 | Console.WriteLine($"日志总数:{result.Count}"); 78 | Console.WriteLine($"首条日志:{result.Logs.FirstOrDefault()}"); 79 | 80 | return result; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/Invocation/InvokeUsingTplExample.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InvokeUsingTplExample.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Linq; 29 | using System.Threading.Tasks; 30 | using Aliyun.Api.LogService.Domain.Log; 31 | 32 | namespace Aliyun.Api.LogService.Examples.Invocation 33 | { 34 | public static class InvokeUsingTplExample 35 | { 36 | /// 37 | /// 在没有 async/await 语法(C# 5.0 以下)的情况下可以使用 TPL 的 `ContinueWith` 方法。 38 | /// 39 | public static Task InvokeUsingTpl(ILogServiceClient client) 40 | => client.GetLogsAsync 41 | ( 42 | // 「必填参数」作为方法的普通必须参数 43 | "example-logstore", 44 | DateTimeOffset.UtcNow.AddDays(-1), 45 | DateTimeOffset.UtcNow, 46 | 47 | // 「可选参数」作为方法的可选参数,可通过命名参数方式指定 48 | offset: 1, 49 | line: 10 50 | ) 51 | .ContinueWith(task => 52 | { 53 | var response = task.Result; // 此处获取 `Result` 不会阻塞,因为在 `ContinueWith` 方法中保证了前置任务必定已完成。 54 | 55 | var result = response 56 | // 此方法会确保返回的响应失败时候抛出`LogServiceException`。 57 | .EnsureSuccess() 58 | // 此处获取Result是安全的。 59 | .Result; 60 | 61 | Console.WriteLine($"RequestId:{response.RequestId}"); 62 | Console.WriteLine($"日志总数:{result.Count}"); 63 | Console.WriteLine($"首条日志:{result.Logs.FirstOrDefault()}"); 64 | 65 | return result; 66 | }); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Examples/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Program.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Examples 30 | { 31 | static class Program 32 | { 33 | static void Main(string[] args) 34 | { 35 | Console.WriteLine("Aliyun LogService SDK for .NET Core."); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Tests/Aliyun.Api.LogService.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | netcoreapp2.0 4 | false 5 | 6 | 7 | 8 | 9 | true 10 | true 11 | $(SolutionDir)/aliyun-log-dotnetcore-sdk.snk 12 | 13 | 14 | 15 | 16 | true 17 | true 18 | $(ProjectDir)../aliyun-log-dotnetcore-sdk.snk 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Tests/ProjectSwitchTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ProjectSwitchTests.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System.Net; 28 | using System.Threading.Tasks; 29 | using Aliyun.Api.LogService.Domain.LogStore; 30 | using Aliyun.Api.LogService.Infrastructure.Protocol.Http; 31 | using Aliyun.Api.LogService.Tests.TestUtils; 32 | using Xunit; 33 | using Xunit.Abstractions; 34 | 35 | namespace Aliyun.Api.LogService.Tests 36 | { 37 | public class ProjectSwitchTests : IClassFixture 38 | { 39 | private readonly ITestOutputHelper output; 40 | private readonly TestContextFixture context; 41 | 42 | public ProjectSwitchTests(ITestOutputHelper output, TestContextFixture context) 43 | { 44 | this.output = output; 45 | this.context = context; 46 | } 47 | 48 | [Fact] 49 | public async Task TestSwitchProject() 50 | { 51 | var response = await this.context.Client.ListLogStoreAsync(); 52 | Assert.True(response.IsSuccess); 53 | 54 | var falseResponse = await this.context.Client.ListLogStoreAsync(new ListLogStoreRequest 55 | { 56 | ProjectName = "non-exist" 57 | }); 58 | Assert.False(falseResponse.IsSuccess); 59 | Assert.Equal(HttpStatusCode.NotFound, falseResponse.GetHttpStatusCode()); 60 | 61 | response = await this.context.Client.ListLogStoreAsync(); 62 | Assert.True(response.IsSuccess); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Tests/StsTokenAccessTest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // StsTokenAccessTest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using System.Net.Http; 31 | using System.Security.Cryptography; 32 | using System.Text; 33 | using System.Threading.Tasks; 34 | using Xunit; 35 | using Xunit.Abstractions; 36 | 37 | namespace Aliyun.Api.LogService.Tests 38 | { 39 | public class StsTokenAccessTest 40 | { 41 | private static readonly String AccessKeyId = ""; 42 | private static readonly String AccessKey = ""; 43 | private static readonly String AssumerRoleArn = "acs:ram:::role/"; 44 | 45 | private readonly ITestOutputHelper output; 46 | 47 | public StsTokenAccessTest(ITestOutputHelper output) 48 | { 49 | this.output = output; 50 | } 51 | 52 | [Fact] 53 | public async Task TestStsTokenAccess() 54 | { 55 | var query = new Dictionary 56 | { 57 | {"Action", "AssumeRole"}, 58 | {"RoleArn", AssumerRoleArn}, 59 | {"RoleSessionName", "foo"}, 60 | {"Format", "JSON"}, 61 | {"Version", "2015-04-01"}, 62 | {"AccessKeyId", AccessKeyId}, 63 | {"SignatureMethod", "HMAC-SHA1"}, 64 | {"SignatureVersion", "1.0"}, 65 | {"SignatureNonce", Guid.NewGuid().ToString()}, 66 | {"Timestamp", DateTimeOffset.UtcNow.ToString("yyyy-MM-dd\\Thh:mm:ss\\Z")}, 67 | }; 68 | 69 | var canonicalizedQueryString = String.Join("&", query 70 | .Select(x => $"{x.Key}={Uri.EscapeDataString(x.Value)}") 71 | .OrderBy(x => x)); 72 | 73 | var signSource = $"GET&%2F&{Uri.EscapeDataString(canonicalizedQueryString)}"; 74 | 75 | var hash = new HMACSHA1(Encoding.UTF8.GetBytes(AccessKey + "&")).ComputeHash(Encoding.UTF8.GetBytes(signSource)); 76 | var signature = Convert.ToBase64String(hash); 77 | 78 | var httpClient = new HttpClient() 79 | { 80 | BaseAddress = new Uri("https://sts.aliyuncs.com"), 81 | }; 82 | 83 | var response = await httpClient.GetAsync("/?" + $"{canonicalizedQueryString}&Signature={signature}"); 84 | 85 | this.output.WriteLine(await response.Content.ReadAsStringAsync()); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Tests/TestUtils/TestContextFixture.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TestContextFixture.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Tests.TestUtils 30 | { 31 | public class TestContextFixture 32 | { 33 | public ILogServiceClient Client { get; } 34 | 35 | public Boolean ShouldInitProject { get; set; } 36 | public Boolean ShouldCleanProject { get; set; } 37 | public Boolean ShouldInit { get; set; } 38 | public Boolean ShouldClean { get; set; } 39 | public Boolean ShouldTestShipper { get; set; } 40 | 41 | public String ProjectName { get; set; } 42 | public String LogStoreName { get; set; } 43 | public String MachineGroupName { get; set; } 44 | public String ConfigName { get; set; } 45 | public String ShipperName { get; set; } 46 | 47 | public Int32 LogStoreTtl { get; set; } = 1; 48 | 49 | public String Cursor { get; set; } 50 | 51 | public Int32 ShardCount { get; set; } = 1; 52 | public Int32 WriteShardId { get; set; } 53 | public Int32 WholeShardId { get; set; } 54 | 55 | public String ShipperTaskId { get; set; } 56 | 57 | public TestContextFixture() 58 | { 59 | this.ShouldInitProject = false; 60 | this.ShouldCleanProject = false; 61 | this.ShouldInit = true; 62 | this.ShouldClean = true; 63 | this.ShouldTestShipper = false; 64 | 65 | var timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); 66 | this.ProjectName = "dotnet-sdk"; 67 | this.LogStoreName = $"logstore-dotnet-sdk-test-{timestamp}"; 68 | this.MachineGroupName = $"machinegroup-dotnet-sdk-test-{timestamp}"; 69 | this.ConfigName = $"config-dotnet-sdk-test-{timestamp}"; 70 | this.ShipperName = "shipper-dotnet-sdk-test"; 71 | 72 | var (accessKey, accessSecret) = LoadCredential(); 73 | this.Client = LogServiceClientBuilders.HttpBuilder 74 | .Endpoint("https://cn-qingdao.log.aliyuncs.com", this.ProjectName) 75 | .Credential(accessKey, accessSecret) 76 | .Build(); 77 | } 78 | 79 | private static (String, String) LoadCredential() 80 | => Boolean.TryParse(Environment.GetEnvironmentVariable("CI"), out var isCi) && isCi 81 | ? (Environment.GetEnvironmentVariable("access_key"), Environment.GetEnvironmentVariable("access_secret")) 82 | : ("", ""); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService.Tests/TestUtils/TestPriorityAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TestPriorityAttribute.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Tests.TestUtils 30 | { 31 | [AttributeUsage(AttributeTargets.Method)] 32 | internal sealed class TestPriorityAttribute : Attribute 33 | { 34 | public Int32 Priority { get; } 35 | 36 | public String[] DependsOn { get; } = { }; 37 | 38 | 39 | public TestPriorityAttribute(Int32 priority) 40 | { 41 | this.Priority = priority; 42 | } 43 | 44 | public TestPriorityAttribute(params String[] dependsOn) 45 | { 46 | this.DependsOn = dependsOn; 47 | } 48 | 49 | public TestPriorityAttribute(Int32 priority, params String[] dependsOn) 50 | { 51 | this.Priority = priority; 52 | this.DependsOn = dependsOn; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Aliyun.Api.LogService.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | netstandard2.0 4 | false 5 | 7.1 6 | Aliyun.SLS.SDK 7 | Aliyun SLS 8 | zh-CN 9 | https://raw.githubusercontent.com/aliyun/aliyun-log-dotnetcore-sdk/master/LICENSE 10 | Aliyun SLS 11 | https://github.com/aliyun/aliyun-log-dotnetcore-sdk 12 | Aliyun 13 | Aliyun LogService .Net Core SDK 14 | true 15 | 1.1.1 16 | Aliyun LogService SDK for .NET Core. 17 | 18 | 19 | true 20 | false 21 | $(SolutionDir)\aliyun-log-dotnetcore-sdk.snk 22 | 23 | 24 | true 25 | $(NoWarn);1591 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/ConfigOutputDetailInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigOutputDetailInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.Config 30 | { 31 | public class ConfigOutputDetailInfo 32 | { 33 | public String LogstoreName { get; } 34 | 35 | public ConfigOutputDetailInfo(String logstoreName) 36 | { 37 | this.LogstoreName = logstoreName; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/CreateConfigRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CreateConfigRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Config 31 | { 32 | public class CreateConfigRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志配置名称, Project 下唯一。 36 | /// 37 | public String ConfigName { get; } 38 | 39 | /// 40 | /// 输入类型,现在只支持 file。 41 | /// 42 | public String InputType { get; } 43 | 44 | /// 45 | /// 输入详情。 46 | /// 47 | public ConfigInputDetailInfo InputDetail { get; } 48 | 49 | /// 50 | /// 输出类型,现在只支持 LogService。 51 | /// 52 | public String OutputType { get; } 53 | 54 | /// 55 | /// 输出详情。 56 | /// 57 | public ConfigOutputDetailInfo OutputDetail { get; } 58 | 59 | /// 60 | /// Logtail 配置日志样例,最大支持 1000 字节。 61 | /// 62 | public String LogSample { get; set; } 63 | 64 | public CreateConfigRequest(String configName, String inputType, ConfigInputDetailInfo inputDetail, String outputType, ConfigOutputDetailInfo outputDetail) 65 | { 66 | this.ConfigName = configName; 67 | this.InputType = inputType; 68 | this.InputDetail = inputDetail; 69 | this.OutputType = outputType; 70 | this.OutputDetail = outputDetail; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/DeleteConfigRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DeleteConfigRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Config 31 | { 32 | public class DeleteConfigRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志配置名称。 36 | /// 37 | public String ConfigName { get; } 38 | 39 | public DeleteConfigRequest(String configName) 40 | { 41 | this.ConfigName = configName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/GetAppliedMachineGroupsRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetAppliedMachineGroupsRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Config 31 | { 32 | public class GetAppliedMachineGroupsRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志配置名称。 36 | /// 37 | public String ConfigName { get; } 38 | 39 | public GetAppliedMachineGroupsRequest(String configName) 40 | { 41 | this.ConfigName = configName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/GetAppliedMachineGroupsResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetAppliedMachineGroupsResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Config 31 | { 32 | public class GetAppliedMachineGroupsResult 33 | { 34 | /// 35 | /// 返回的 machineGroup 数目。 36 | /// 37 | public Int32 Count { get; } 38 | 39 | /// 40 | /// 返回的 machineGroup 名称列表。 41 | /// 42 | public IList MachineGroups { get; } 43 | 44 | public GetAppliedMachineGroupsResult(Int32 count, IList machineGroups) 45 | { 46 | this.Count = count; 47 | this.MachineGroups = machineGroups; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/GetConfigRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetConfigRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Config 31 | { 32 | public class GetConfigRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志配置名称。 36 | /// 37 | public String ConfigName { get; } 38 | 39 | public GetConfigRequest(String configName) 40 | { 41 | this.ConfigName = configName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/GetConfigResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetConfigResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.Config 30 | { 31 | public class GetConfigResult 32 | { 33 | /// 34 | /// 日志配置名称, Project 下唯一。 35 | /// 36 | public String ConfigName { get; } 37 | 38 | /// 39 | /// 输入类型,现在只支持 file。 40 | /// 41 | public String InputType { get; } 42 | 43 | /// 44 | /// 输入详情。 45 | /// 46 | public ConfigInputDetailInfo InputDetail { get; } 47 | 48 | /// 49 | /// 输出类型,现在只支持 LogService。 50 | /// 51 | public String OutputType { get; } 52 | 53 | /// 54 | /// 输出详情。 55 | /// 56 | public ConfigOutputDetailExtInfo OutputDetail { get; } 57 | 58 | /// 59 | /// 配置创建时间。 60 | /// 61 | public Int32 CreateTime { get; } 62 | 63 | /// 64 | /// 该资源服务端更新时间。 65 | /// 66 | public Int32 LastModifyTime { get; } 67 | 68 | public GetConfigResult(String configName, String inputType, ConfigInputDetailInfo inputDetail, String outputType, ConfigOutputDetailExtInfo outputDetail, Int32 createTime, Int32 lastModifyTime) 69 | { 70 | this.ConfigName = configName; 71 | this.InputType = inputType; 72 | this.InputDetail = inputDetail; 73 | this.OutputType = outputType; 74 | this.OutputDetail = outputDetail; 75 | this.CreateTime = createTime; 76 | this.LastModifyTime = lastModifyTime; 77 | } 78 | 79 | public class ConfigOutputDetailExtInfo : ConfigOutputDetailInfo 80 | { 81 | /// 82 | /// Project 所在的访问地址。 83 | /// 84 | public String Endpoint { get; } 85 | 86 | public ConfigOutputDetailExtInfo(String logstoreName, String endpoint) 87 | : base(logstoreName) 88 | { 89 | this.Endpoint = endpoint; 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/ListConfigRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListConfigRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Config 31 | { 32 | public class ListConfigRequest : ProjectScopedRequest 33 | { 34 | public const Int32 DefaultOffset = 0; 35 | public const Int32 DefaultSize = 500; 36 | 37 | /// 38 | /// 返回记录的起始位置,默认为 0。 39 | /// 40 | public Int32 Offset { get; set; } = DefaultOffset; 41 | 42 | /// 43 | /// 每页返回最大条目,默认 500(最大值)。 44 | /// 45 | public Int32 Size { get; set; } = DefaultSize; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/ListConfigResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListConfigResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Config 31 | { 32 | public class ListConfigResult 33 | { 34 | /// 35 | /// 返回的 config 数目。 36 | /// 37 | public Int32 Count { get; } 38 | 39 | /// 40 | /// 在服务端 config 总数。 41 | /// 42 | public Int32 Total { get; } 43 | 44 | /// 45 | /// 返回的 config 名称列表。 46 | /// 47 | public IList Configs { get; } 48 | 49 | public ListConfigResult(Int32 count, Int32 total, IList configs) 50 | { 51 | this.Count = count; 52 | this.Total = total; 53 | this.Configs = configs; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Config/UpdateConfigRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UpdateConfigRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Config 31 | { 32 | public class UpdateConfigRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志配置名称, Project 下唯一。 36 | /// 37 | public String ConfigName { get; } 38 | 39 | /// 40 | /// 输入类型,现在只支持 file。 41 | /// 42 | public String InputType { get; } 43 | 44 | /// 45 | /// 输入详情。 46 | /// 47 | public ConfigInputDetailInfo InputDetail { get; } 48 | 49 | /// 50 | /// 输出类型,现在只支持 LogService。 51 | /// 52 | public String OutputType { get; } 53 | 54 | /// 55 | /// 输出详情。 56 | /// 57 | public ConfigOutputDetailInfo OutputDetail { get; } 58 | 59 | public UpdateConfigRequest(String configName, String inputType, ConfigInputDetailInfo inputDetail, String outputType, ConfigOutputDetailInfo outputDetail) 60 | { 61 | this.ConfigName = configName; 62 | this.InputType = inputType; 63 | this.InputDetail = inputDetail; 64 | this.OutputType = outputType; 65 | this.OutputDetail = outputDetail; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/GetLogHistogramsRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetLogHistogramsRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Log 31 | { 32 | public class GetLogHistogramsRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 需要查询日志的 Logstore 名称。 36 | /// 37 | public String Logstorename { get; } 38 | 39 | /// 40 | /// 查询开始时间点(精度为秒,从 1970-1-1 00:00:00 UTC 计算起的秒数)。 41 | /// 42 | public Int32 From { get; } 43 | 44 | /// 45 | /// 查询结束时间点(精度为秒,从 1970-1-1 00:00:00 UTC 计算起的秒数)。 46 | /// 47 | public Int32 To { get; } 48 | 49 | /// 50 | /// 查询日志主题。 51 | /// 52 | public String Topic { get; set; } 53 | 54 | /// 55 | /// 查询表达式。关于查询表达式的详细语法,请参考 查询语法。 56 | /// 57 | public String Query { get; set; } 58 | 59 | public GetLogHistogramsRequest(String logstorename, Int32 from, Int32 to) 60 | { 61 | this.Logstorename = logstorename; 62 | this.From = from; 63 | this.To = to; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/GetLogHistogramsResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetLogHistogramsResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Log 31 | { 32 | public class GetLogHistogramsResult 33 | { 34 | /// 35 | /// 查询结果的状态。可以有 Incomplete 和 Complete 两个选值,表示结果是否完整。 36 | /// 37 | public LogProgressState Progress { get; set; } 38 | 39 | /// 40 | /// 当前查询结果中所有日志总数。 41 | /// 42 | public Int32 Count { get; set; } 43 | 44 | /// 45 | /// 当前查询结果在划分的子时间区间上的分布状况,具体结构见下面的描述。 46 | /// 47 | public IList Histograms { get; } 48 | 49 | public GetLogHistogramsResult(IList histograms) 50 | { 51 | this.Histograms = histograms; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/GetLogsRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetLogsRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Log 31 | { 32 | public class GetLogsRequest : ProjectScopedRequest 33 | { 34 | public const Int32 DefaultLine = 100; 35 | public const Int32 DefaultOffset = 0; 36 | public const Boolean DefaultReverse = false; 37 | 38 | /// 39 | /// 需要查询日志的 Logstore 名称。 40 | /// 41 | public String Logstorename { get; } 42 | 43 | /// 44 | /// 查询开始时间点(精度为秒,从 1970-1-1 00:00:00 UTC 计算起的秒数)。 45 | /// 46 | public Int32 From { get; } 47 | 48 | /// 49 | /// 查询结束时间点(精度为秒,从 1970-1-1 00:00:00 UTC 计算起的秒数)。 50 | /// 51 | public Int32 To { get; } 52 | 53 | /// 54 | /// 查询日志主题。 55 | /// 56 | public String Topic { get; set; } 57 | 58 | /// 59 | /// 查询表达式。关于查询表达式的详细语法,请参考 查询语法。 60 | /// 61 | public String Query { get; set; } 62 | 63 | /// 64 | /// 请求返回的最大日志条数。取值范围为 0~100,默认值为 100。 65 | /// 66 | public Int32 Line { get; set; } 67 | 68 | /// 69 | /// 请求返回日志的起始点。取值范围为 0 或正整数,默认值为 0。 70 | /// 71 | public Int32 Offset { get; set; } 72 | 73 | /// 74 | /// 是否按日志时间戳逆序返回日志。true 表示逆序,false 表示顺序,默认值为 false。 75 | /// 76 | public Boolean Reverse { get; set; } 77 | 78 | public GetLogsRequest(String logstorename, Int32 from, Int32 to) 79 | { 80 | this.Logstorename = logstorename; 81 | this.From = from; 82 | this.To = to; 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/GetLogsResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetLogsResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Log 31 | { 32 | public class GetLogsResult 33 | { 34 | /// 35 | /// 查询结果的状态。可以有 Incomplete 和 Complete 两个选值,表示本次是否完整。 36 | /// 37 | public LogProgressState Progress { get; set; } 38 | 39 | /// 40 | /// 当前查询结果返回的日志总数(非总数)。 41 | /// 42 | public Int32 Count { get; set; } 43 | 44 | /// 45 | /// 46 | /// 47 | public Int32 ProcessedRows { get; set; } 48 | 49 | /// 50 | /// 51 | /// 52 | public Int32 ElapsedMillisecond { get; set; } 53 | 54 | /// 55 | /// 56 | /// 57 | public Boolean HasSql { get; set; } 58 | 59 | /// 60 | /// 61 | /// 62 | public String AggQuery { get; set; } 63 | 64 | /// 65 | /// 66 | /// 67 | public String WhereQuery { get; set; } 68 | 69 | /// 70 | /// 71 | /// 72 | public LogQueryInfo QueryInfo { get; set; } 73 | 74 | /// 75 | /// 日志内容。 76 | /// 77 | public IList> Logs { get; } 78 | 79 | public GetLogsResult(IList> logs) 80 | { 81 | this.Logs = logs; 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/GetProjectLogsRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetProjectLogsRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Log 31 | { 32 | public class GetProjectLogsRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 查询sql条件。 36 | /// 37 | public String Query { get; } 38 | 39 | public GetProjectLogsRequest(String query) 40 | { 41 | this.Query = query; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/LogGroupInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogGroupInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Log 31 | { 32 | public class LogGroupInfo 33 | { 34 | public String Topic { get; set; } 35 | 36 | public String Source { get; set; } 37 | 38 | public IDictionary LogTags { get; set; } 39 | 40 | public IList Logs { get; set; } 41 | 42 | public LogGroupInfo() 43 | { 44 | this.LogTags = new Dictionary(); 45 | this.Logs = new List(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/LogHistogramInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogHistogramInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.Log 30 | { 31 | public class LogHistogramInfo 32 | { 33 | /// 34 | /// 子时间区间的开始时间点(精度为秒,从 1970-1-1 00:00:00 UTC 计算起的秒数)。 35 | /// 36 | public Int32 From { get; } 37 | 38 | /// 39 | /// 子时间区间的结束时间点(精度为秒,从 1970-1-1 00:00:00 UTC 计算起的秒数)。 40 | /// 41 | public Int32 To { get; } 42 | 43 | /// 44 | /// 当前查询结果在该子时间区间内命中的日志条数。 45 | /// 46 | public Int32 Count { get; } 47 | 48 | /// 49 | /// 当前查询结果在该子时间区间内的结果是否完整,可以有 Incomplete 和 Complete 两个选值。 50 | /// 51 | public LogProgressState Progress { get; } 52 | 53 | public LogHistogramInfo(Int32 from, Int32 to, Int32 count, LogProgressState progress) 54 | { 55 | this.From = from; 56 | this.To = to; 57 | this.Count = count; 58 | this.Progress = progress; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/LogInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using Aliyun.Api.LogService.Utils; 31 | 32 | namespace Aliyun.Api.LogService.Domain.Log 33 | { 34 | public class LogInfo 35 | { 36 | public static IEnumerable InvalidContentKeys { get; } = new HashSet 37 | { 38 | "__time__", 39 | "__source__", 40 | "__topic__", 41 | "__partition_time__", 42 | "_extract_others_", 43 | "__extract_others__" 44 | }; 45 | 46 | public DateTimeOffset Time { get; set; } 47 | 48 | public IDictionary Contents { get; set; } 49 | 50 | public LogInfo() 51 | { 52 | this.Contents = new Dictionary(); 53 | } 54 | 55 | public void Validate() 56 | { 57 | var invalidKeys = this.Contents.Keys.Intersect(InvalidContentKeys).ToArray(); 58 | if (invalidKeys.IsNotEmpty()) 59 | { 60 | throw new ArgumentException($"{nameof(this.Contents)} contains forbidden keys: {String.Join(", ", invalidKeys)}."); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/LogProgressState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogProgressState.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace Aliyun.Api.LogService.Domain.Log 28 | { 29 | /** 30 | * 查询结果状态。 31 | */ 32 | public enum LogProgressState 33 | { 34 | /** 35 | * 本次查询返回的结果是完整的结果。 36 | */ 37 | Complete, 38 | 39 | /** 40 | * 本次查询返回的结果只是部分结果。 41 | */ 42 | Incomplete 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/LogQueryInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogQueryInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Log 31 | { 32 | public class LogQueryInfo 33 | { 34 | /// 35 | /// 36 | /// 37 | public IList Keys { get; } 38 | 39 | /// 40 | /// 41 | /// 42 | public IList> Terms { get; } 43 | 44 | public LogQueryInfo(IList keys, IList> terms) 45 | { 46 | this.Keys = keys; 47 | this.Terms = terms; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/PostLogsRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PostLogsRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Log 31 | { 32 | public class PostLogsRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志库名称。 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | /// 40 | /// 一组日志。 41 | /// 42 | public LogGroupInfo LogGroup { get; } 43 | 44 | /// 45 | ///(可选)标记日志应该路由到哪个 shard 的标记。 46 | /// 47 | public String HashKey { get; set; } 48 | 49 | public PostLogsRequest(String logstoreName, LogGroupInfo logGroup) 50 | { 51 | this.LogstoreName = logstoreName; 52 | this.LogGroup = logGroup; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/PullLogsRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PullLogsRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Log 31 | { 32 | public class PullLogsRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志库名称 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | /// 40 | /// Shard ID 41 | /// 42 | public Int32 ShardId { get; } 43 | 44 | /// 45 | /// 游标,用以表示从什么位置开始读取数据,相当于起点。 46 | /// 47 | public String Cursor { get; } 48 | 49 | /// 50 | /// 返回的 loggroup 数目,范围为 0~1000。 51 | /// 52 | public Int32 Count { get; } 53 | 54 | public PullLogsRequest(String logstoreName, Int32 shardId, String cursor, Int32 count) 55 | { 56 | this.LogstoreName = logstoreName; 57 | this.ShardId = shardId; 58 | this.Cursor = cursor; 59 | this.Count = count; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Log/PullLogsResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // PullLogsResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System.Collections.Generic; 28 | 29 | namespace Aliyun.Api.LogService.Domain.Log 30 | { 31 | public class PullLogsResult 32 | { 33 | public IList LogGroups { get; } 34 | 35 | public PullLogsResult(IList logGroups) 36 | { 37 | this.LogGroups = logGroups; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogServiceException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogServiceClientBuilders.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Infrastructure.Protocol; 29 | 30 | namespace Aliyun.Api.LogService.Domain 31 | { 32 | /// 33 | /// 日志服务业务异常。 34 | /// 35 | public class LogServiceException : Exception 36 | { 37 | /// 38 | /// 服务端产生的标示该请求的唯一 ID。 39 | /// 该响应头与具体应用无关,主要用于跟踪和调查问题。 40 | /// 如果用户希望调查出现问题的 API 请求,可以向 Log Service 团队提供该 ID。 41 | /// 42 | public String RequestId { get; } 43 | 44 | /// 45 | /// 对应的错误码。 46 | /// 47 | public ErrorCode ErrorCode { get; } 48 | 49 | /// 50 | /// 对应的错误消息。 51 | /// 52 | public String ErrorMessage { get; } 53 | 54 | public LogServiceException(String requestId, ErrorCode errorCode) 55 | : base(FormatMessage(requestId, errorCode)) 56 | { 57 | this.RequestId = requestId; 58 | this.ErrorCode = errorCode; 59 | this.ErrorMessage = null; 60 | } 61 | 62 | public LogServiceException(String requestId, ErrorCode errorCode, String errorMessage) 63 | : base(FormatMessage(requestId, errorCode, errorMessage)) 64 | { 65 | this.RequestId = requestId; 66 | this.ErrorCode = errorCode; 67 | this.ErrorMessage = errorMessage; 68 | } 69 | 70 | public LogServiceException(String requestId, ErrorCode errorCode, Exception innerException) 71 | : base(FormatMessage(requestId, errorCode), innerException) 72 | { 73 | this.RequestId = requestId; 74 | this.ErrorCode = errorCode; 75 | this.ErrorMessage = null; 76 | } 77 | 78 | public LogServiceException(String requestId, ErrorCode errorCode, String errorMessage, Exception innerException) 79 | : base(FormatMessage(requestId, errorCode), innerException) 80 | { 81 | this.RequestId = requestId; 82 | this.ErrorCode = errorCode; 83 | this.ErrorMessage = errorMessage; 84 | } 85 | 86 | private static String FormatMessage(String requestId, ErrorCode errorCode, String errorMessage = null) 87 | => $"[{requestId}] {errorCode}{(errorMessage == null ? String.Empty : $" ({errorMessage})")}"; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/CreateLogStoreRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CreateLogStoreRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore 31 | { 32 | public class CreateLogStoreRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// Logstore 的名称,在 Project 下必须唯一。 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | /// 40 | /// 数据的保存时间,单位为天,范围1~365(额外需求请提交工单)。 41 | /// 42 | public Int32 Ttl { get; } 43 | 44 | /// 45 | /// 该 Logstore 的 Shard 数量,单位为个,范围为 1~10。 46 | /// 47 | public Int32 ShardCount { get; } 48 | 49 | public CreateLogStoreRequest(String logstoreName, Int32 ttl, Int32 shardCount) 50 | { 51 | this.LogstoreName = logstoreName; 52 | this.Ttl = ttl; 53 | this.ShardCount = shardCount; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/DeleteLogStoreRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DeleteLogStoreRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore 31 | { 32 | public class DeleteLogStoreRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// Logstore 的名称,在 Project 下必须唯一。 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | public DeleteLogStoreRequest(String logstoreName) 40 | { 41 | this.LogstoreName = logstoreName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/GetLogStoreRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetLogStoreRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore 31 | { 32 | public class GetLogStoreRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// Logstore 的名称,在 Project 下必须唯一。 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | public GetLogStoreRequest(String logstoreName) 40 | { 41 | this.LogstoreName = logstoreName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/GetLogStoreResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetLogStoreResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.LogStore 30 | { 31 | public class GetLogStoreResult 32 | { 33 | /// 34 | /// logstore 的名称, 在该 project 下唯一。 35 | /// 36 | public String LogstoreName { get; } 37 | 38 | /// 39 | /// 日志数据生命周期(TTL),单位为天,最小为 1 天。 40 | /// 41 | public Int32 Ttl { get; } 42 | 43 | /// 44 | /// 日志数据 服务单元。 45 | /// 46 | public Int32 ShardCount { get; } 47 | 48 | /// 49 | /// 该资源服务端创建时间。 50 | /// 51 | public Int32 CreateTime { get; } 52 | 53 | /// 54 | /// 该资源服务端更新时间。 55 | /// 56 | public Int32 LastModifyTime { get; } 57 | 58 | public GetLogStoreResult(String logstoreName, Int32 ttl, Int32 shardCount, Int32 createTime, Int32 lastModifyTime) 59 | { 60 | this.LogstoreName = logstoreName; 61 | this.Ttl = ttl; 62 | this.ShardCount = shardCount; 63 | this.CreateTime = createTime; 64 | this.LastModifyTime = lastModifyTime; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Index/CreateIndexRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CreateIndexRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using Aliyun.Api.LogService.Domain.Project; 30 | using Newtonsoft.Json; 31 | 32 | namespace Aliyun.Api.LogService.Domain.LogStore.Index 33 | { 34 | public class CreateIndexRequest : ProjectScopedRequest 35 | { 36 | /// 37 | /// Logstore 的名称,在 Project 下必须唯一。 38 | /// 39 | [JsonIgnore] 40 | public String LogstoreName { get; } 41 | 42 | /// 43 | /// 全文索引,对于日志中value的索引属性,全文索引和字段查询必须至少配置一类。 44 | /// 45 | public IndexLineInfo Line { get; } 46 | 47 | /// 48 | /// 字段查询,对于具体字段的value索引属性,全文索引和字段查询必须至少配置一类。 49 | /// 50 | public IDictionary Keys { get; } 51 | 52 | public CreateIndexRequest(String logstoreName, IndexLineInfo line) : this(logstoreName, line, null) 53 | { 54 | // Delegate constructor. 55 | } 56 | 57 | public CreateIndexRequest(String logstoreName, IDictionary keys) : this(logstoreName, null, keys) 58 | { 59 | // Delegate constructor. 60 | } 61 | 62 | public CreateIndexRequest(String logstoreName, IndexLineInfo line, IDictionary keys) 63 | { 64 | this.Line = line; 65 | this.Keys = keys; 66 | this.LogstoreName = logstoreName; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Index/IndexLineInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IndexLineInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using Aliyun.Api.LogService.Utils; 30 | 31 | namespace Aliyun.Api.LogService.Domain.LogStore.Index 32 | { 33 | public class IndexLineInfo 34 | { 35 | /// 36 | /// 是否区分大小写,默认值为false,表示不区分。 37 | /// 38 | public Boolean? CaseSensitive { get; set; } 39 | 40 | /// 41 | /// 分词字符列表,只支持单个英文字符。 42 | /// 43 | public IEnumerable Token { get; } 44 | 45 | /// 46 | /// 是否进行中文分词,默认值为false,表示不进行中文分词。 47 | /// 48 | public Boolean? Chn { get; set; } 49 | 50 | public IndexLineInfo(IEnumerable token) 51 | { 52 | this.Token = token.Freeze(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/ListLogStoreRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListLogStoreRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore 31 | { 32 | public class ListLogStoreRequest : ProjectScopedRequest 33 | { 34 | internal const Int32 DefaultOffset = 1; 35 | internal const Int32 DefaultSize = 500; 36 | 37 | /// 38 | /// 用于请求的 Logstore 名称(支持部分匹配)。 39 | /// 40 | public String LogstoreName { get; set; } 41 | 42 | /// 43 | /// 返回记录的起始位置,默认值为 1。 44 | /// 45 | public Int32 Offset { get; set; } = DefaultOffset; 46 | 47 | /// 48 | /// 每页返回最大条目,默认 500(最大值)。 49 | /// 50 | public Int32 Size { get; set; } = DefaultSize; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/ListLogStoreResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListLogStoreResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore 31 | { 32 | public class ListLogStoreResult 33 | { 34 | /// 35 | /// 返回的 Logstore 数目。 36 | /// 37 | public Int32 Count { get; } 38 | 39 | /// 40 | /// Logstore 总数。 41 | /// 42 | public Int32 Total { get; } 43 | 44 | /// 45 | /// 返回的 Logstore 名称列表。 46 | /// 47 | public IList Logstores { get; } 48 | 49 | public ListLogStoreResult(Int32 count, Int32 total, IList logstores) 50 | { 51 | this.Count = count; 52 | this.Total = total; 53 | this.Logstores = logstores; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Shard/GetCursorRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetCursorRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore.Shard 31 | { 32 | public class GetCursorRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志库名称 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | /// 40 | /// Shard ID 41 | /// 42 | public Int32 ShardId { get; } 43 | 44 | /// 45 | /// 时间点(UNIX下秒数),或 begin,end 46 | /// 47 | public String From { get; } 48 | 49 | public GetCursorRequest(String logstoreName, Int32 shardId, String from) 50 | { 51 | this.LogstoreName = logstoreName; 52 | this.ShardId = shardId; 53 | this.From = from; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Shard/GetCursorResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetCursorResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.LogStore.Shard 30 | { 31 | public class GetCursorResult 32 | { 33 | /// 34 | /// 游标 35 | /// 36 | public String Cursor { get; } 37 | 38 | public GetCursorResult(String cursor) 39 | { 40 | this.Cursor = cursor; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Shard/ListShardRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListShardRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore.Shard 31 | { 32 | public class ListShardRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志库名称 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | public ListShardRequest(String logstoreName) 40 | { 41 | this.LogstoreName = logstoreName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Shard/MergeShardRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MergeShardRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore.Shard 31 | { 32 | public class MergeShardRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志库名称 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | /// 40 | /// Shard ID 41 | /// 42 | public Int32 ShardId { get; } 43 | 44 | public MergeShardRequest(String logstoreName, Int32 shardId) 45 | { 46 | this.LogstoreName = logstoreName; 47 | this.ShardId = shardId; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Shard/ShardInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ShardInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.LogStore.Shard 30 | { 31 | public class ShardInfo 32 | { 33 | /// 34 | /// Shard ID,分区号。 35 | /// 36 | public Int32 ShardId { get; } 37 | 38 | /// 39 | /// 分区的状态。 40 | /// 41 | /// readwrite:可以读写 42 | /// readonly:只读数据 43 | /// 44 | /// 45 | public ShardState Status { get; } 46 | 47 | /// 48 | /// 分区起始的Key值,分区范围中包含该Key值。 49 | /// 50 | public String InclusiveBeginKey { get; } 51 | 52 | /// 53 | /// 分区结束的Key值,分区范围中不包含该Key值。 54 | /// 55 | public String ExclusiveEndKey { get; } 56 | 57 | /// 58 | /// 分区创建时间。 59 | /// 60 | public Int64 CreateTime { get; } 61 | 62 | public ShardInfo(Int32 shardId, ShardState status, String inclusiveBeginKey, String exclusiveEndKey, Int64 createTime) 63 | { 64 | this.ShardId = shardId; 65 | this.Status = status; 66 | this.InclusiveBeginKey = inclusiveBeginKey; 67 | this.ExclusiveEndKey = exclusiveEndKey; 68 | this.CreateTime = createTime; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Shard/ShardState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ShardState.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace Aliyun.Api.LogService.Domain.LogStore.Shard 28 | { 29 | /// 30 | /// 分区状态。 31 | /// 32 | public enum ShardState 33 | { 34 | /// 35 | /// 只读。 36 | /// 37 | ReadOnly, 38 | 39 | /// 40 | /// 可以读写。 41 | /// 42 | ReadWrite, 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Shard/SplitShardRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SplitShardRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore.Shard 31 | { 32 | public class SplitShardRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 日志库名称 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | /// 40 | /// Shard ID 41 | /// 42 | public Int32 ShardId { get; } 43 | 44 | /// 45 | /// split 切分位置 46 | /// 47 | public String SplitKey { get; } 48 | 49 | public SplitShardRequest(String logstoreName, Int32 shardId, String splitKey) 50 | { 51 | this.LogstoreName = logstoreName; 52 | this.ShardId = shardId; 53 | this.SplitKey = splitKey; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Shipper/GetShipperRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetShipperRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore.Shipper 31 | { 32 | public class GetShipperRequest : ProjectScopedRequest 33 | { 34 | public const Int32 DefaultOffset = 0; 35 | 36 | public const Int32 DefaultSize = 100; 37 | 38 | /// 39 | /// 日志库名称,同一 Project 下唯一。 40 | /// 41 | public String LogstoreName { get; } 42 | 43 | /// 44 | /// 日志投递规则名称,同一 Logstore 下唯一。 45 | /// 46 | public String ShipperName { get; } 47 | 48 | /// 49 | /// 日志投递任务创建时间区间。 50 | /// 51 | public Int32 From { get; } 52 | 53 | /// 54 | /// 日志投递任务创建时间区间。 55 | /// 56 | public Int32 To { get; } 57 | 58 | /// 59 | /// 默认为空,表示返回所有状态的任务,目前支持 success/fail/running 等状态。 60 | /// 61 | public String Status { get; set; } 62 | 63 | /// 64 | /// 返回指定时间区间内投递任务的起始数目,默认值为 0。 65 | /// 66 | public Int32 Offset { get; set; } = DefaultOffset; 67 | 68 | /// 69 | /// 返回指定时间区间内投递任务的数目,默认值为 100,最大为 500。 70 | /// 71 | public Int32 Size { get; set; } = DefaultSize; 72 | 73 | public GetShipperRequest(String logstoreName, String shipperName, Int32 from, Int32 to) 74 | { 75 | this.LogstoreName = logstoreName; 76 | this.ShipperName = shipperName; 77 | this.From = from; 78 | this.To = to; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/Shipper/RetryShipperRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RetryShipperRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using Aliyun.Api.LogService.Domain.Project; 30 | 31 | namespace Aliyun.Api.LogService.Domain.LogStore.Shipper 32 | { 33 | public class RetryShipperRequest : ProjectScopedRequest 34 | { 35 | /// 36 | /// 日志库名称,同一 Project 下唯一。 37 | /// 38 | public String LogstoreName { get; } 39 | 40 | /// 41 | /// 日志投递规则名称,同一 Logstore 下唯一。 42 | /// 43 | public String ShipperName { get; } 44 | 45 | /// 46 | /// 需要重试的任务ID。 47 | /// 48 | public IEnumerable TaskIds { get; } 49 | 50 | public RetryShipperRequest(String logstoreName, String shipperName, IEnumerable taskIds) 51 | { 52 | this.LogstoreName = logstoreName; 53 | this.ShipperName = shipperName; 54 | this.TaskIds = taskIds; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/LogStore/UpdateLogStoreRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UpdateLogStoreRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.LogStore 31 | { 32 | public class UpdateLogStoreRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// Logstore 的名称,在 Project 下必须唯一。 36 | /// 37 | public String LogstoreName { get; } 38 | 39 | /// 40 | /// 数据的保存时间,单位为天,范围1~365(额外需求请提交工单)。 41 | /// 42 | public Int32 Ttl { get; } 43 | 44 | /// 45 | /// 该 Logstore 的 Shard 数量,单位为个,范围为 1~10。 46 | /// 47 | public Int32 ShardCount { get; } 48 | 49 | public UpdateLogStoreRequest(String logstoreName, Int32 ttl, Int32 shardCount) 50 | { 51 | this.LogstoreName = logstoreName; 52 | this.Ttl = ttl; 53 | this.ShardCount = shardCount; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/ApplyConfigToMachineGroupRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ApplyConfigToMachineGroupRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class ApplyConfigToMachineGroupRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 机器分组名称。 36 | /// 37 | public String GroupName { get; } 38 | 39 | /// 40 | /// 日志配置名称。 41 | /// 42 | public String ConfigName { get; } 43 | 44 | public ApplyConfigToMachineGroupRequest(String groupName, String configName) 45 | { 46 | this.GroupName = groupName; 47 | this.ConfigName = configName; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/CreateMachineGroupRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CreateMachineGroupRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using Aliyun.Api.LogService.Domain.Project; 30 | 31 | namespace Aliyun.Api.LogService.Domain.MachineGroup 32 | { 33 | public class CreateMachineGroupRequest : ProjectScopedRequest 34 | { 35 | /// 36 | /// 机器分组名称。 37 | /// 38 | public String GroupName { get; } 39 | 40 | /// 41 | /// 机器分组类型,默认为空。 42 | /// 43 | public String GroupType { get; set; } 44 | 45 | /// 46 | /// 机器标识类型,分为 IP 和 userdefined 两种。 47 | /// 48 | public String MachineIdentifyType { get; } 49 | 50 | /// 51 | /// 机器分组的属性,默认为空。 52 | /// 53 | public MachineGroupAttributeInfo GroupAttribute { get; set; } 54 | 55 | /// 56 | /// 具体的机器标识,可以是 IP 或 userdefined-id。 57 | /// 58 | public IEnumerable MachineList { get; } 59 | 60 | public CreateMachineGroupRequest(String groupName, String machineIdentifyType, IEnumerable machineList) 61 | { 62 | this.GroupName = groupName; 63 | this.MachineIdentifyType = machineIdentifyType; 64 | this.MachineList = machineList; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/DeleteMachineGroupRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DeleteMachineGroupRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class DeleteMachineGroupRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 机器分组名称。 36 | /// 37 | public String GroupName { get; } 38 | 39 | public DeleteMachineGroupRequest(String groupName) 40 | { 41 | this.GroupName = groupName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/GetAppliedConfigsRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetAppliedConfigsRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class GetAppliedConfigsRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 机器分组名称。 36 | /// 37 | public String GroupName { get; } 38 | 39 | public GetAppliedConfigsRequest(String groupName) 40 | { 41 | this.GroupName = groupName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/GetAppliedConfigsResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetAppliedConfigsResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class GetAppliedConfigsResult 33 | { 34 | /// 35 | /// 返回的 config 数目。 36 | /// 37 | public Int32 Count { get; } 38 | 39 | /// 40 | /// 返回的 config 名称列表。 41 | /// 42 | public IList Configs { get; } 43 | 44 | public GetAppliedConfigsResult(Int32 count, IList configs) 45 | { 46 | this.Count = count; 47 | this.Configs = configs; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/GetMachineGroupRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetMachineGroupRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class GetMachineGroupRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 机器分组名称。 36 | /// 37 | public String GroupName { get; } 38 | 39 | public GetMachineGroupRequest(String groupName) 40 | { 41 | this.GroupName = groupName; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/GetMachineGroupResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetMachineGroupResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class GetMachineGroupResult 33 | { 34 | /// 35 | /// 机器分组名称。 36 | /// 37 | public String GroupName { get; } 38 | 39 | /// 40 | /// 机器分组类型,默认为空。 41 | /// 42 | public String GroupType { get; set; } 43 | 44 | /// 45 | /// 机器分组的属性,默认为空。 46 | /// 47 | public MachineGroupAttributeInfo GroupAttribute { get; } 48 | 49 | /// 50 | /// 机器标识类型,分为 IP 和 userdefined 两种。 51 | /// 52 | public String MachineIdentifyType { get; } 53 | 54 | /// 55 | /// 具体的机器标识,可以是 IP 或 userdefined-id。 56 | /// 57 | public IEnumerable MachineList { get; } 58 | 59 | /// 60 | /// 机器分组创建时间。 61 | /// 62 | public Int32 CreateTime { get; } 63 | 64 | /// 65 | /// 机器分组最近更新时间。 66 | /// 67 | public Int32 LastModifyTime { get; } 68 | 69 | public GetMachineGroupResult(String groupName, String groupType, MachineGroupAttributeInfo groupAttribute, String machineIdentifyType, 70 | IEnumerable machineList, Int32 createTime, Int32 lastModifyTime) 71 | { 72 | this.GroupName = groupName; 73 | this.GroupType = groupType; 74 | this.GroupAttribute = groupAttribute; 75 | this.MachineIdentifyType = machineIdentifyType; 76 | this.MachineList = machineList; 77 | this.CreateTime = createTime; 78 | this.LastModifyTime = lastModifyTime; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/ListMachineGroupRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListMachineGroupRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class ListMachineGroupRequest : ProjectScopedRequest 33 | { 34 | public const Int32 DefaultOffset = 0; 35 | public const Int32 DefaultSize = 500; 36 | 37 | /// 38 | /// 用于过滤的机器组名称(支持部分匹配)。 39 | /// 40 | public String GroupName { get; set; } 41 | 42 | /// 43 | /// 返回记录的起始位置,默认为 0。 44 | /// 45 | public Int32 Offset { get; set; } = DefaultOffset; 46 | 47 | /// 48 | /// 每页返回最大条目,默认 500(最大值)。 49 | /// 50 | public Int32 Size { get; set; } = DefaultSize; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/ListMachineGroupResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListMachineGroupResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class ListMachineGroupResult 33 | { 34 | /// 35 | /// 返回的 machinegroup 数目。 36 | /// 37 | public Int32 Count { get; } 38 | 39 | /// 40 | /// 返回 machinegroup 总数。 41 | /// 42 | public Int32 Total { get; } 43 | 44 | /// 45 | /// 返回的 machinegroup 名称列表。 46 | /// 47 | public IList MachineGroups { get; } 48 | 49 | public ListMachineGroupResult(Int32 count, Int32 total, IList machineGroups) 50 | { 51 | this.Count = count; 52 | this.Total = total; 53 | this.MachineGroups = machineGroups; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/ListMachinesRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListMachinesRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class ListMachinesRequest : ProjectScopedRequest 33 | { 34 | public const Int32 DefaultOffset = 0; 35 | public const Int32 DefaultSize = 500; 36 | 37 | /// 38 | /// 机器分组名称。 39 | /// 40 | public String GroupName { get; } 41 | 42 | /// 43 | /// 返回记录的起始位置,默认为 0。 44 | /// 45 | public Int32 Offset { get; set; } = DefaultOffset; 46 | 47 | /// 48 | /// 每页返回最大条目,默认 500(最大值)。 49 | /// 50 | public Int32 Size { get; set; } = DefaultSize; 51 | 52 | public ListMachinesRequest(String groupName) 53 | { 54 | this.GroupName = groupName; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/ListMachinesResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListMachinesResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class ListMachinesResult 33 | { 34 | /// 35 | /// 返回的 machinegroup 数目。 36 | /// 37 | public Int32 Count { get; } 38 | 39 | /// 40 | /// 返回 machinegroup 总数。 41 | /// 42 | public Int32 Total { get; } 43 | 44 | /// 45 | /// 返回的 machinegroup 名称列表。 46 | /// 47 | public IList Machines { get; } 48 | 49 | public ListMachinesResult(Int32 count, Int32 total, IList machines) 50 | { 51 | this.Count = count; 52 | this.Total = total; 53 | this.Machines = machines; 54 | } 55 | 56 | public class MachineInfo 57 | { 58 | /// 59 | /// 机器的 IP。 60 | /// 61 | public String Ip { get; } 62 | 63 | /// 64 | /// 机器 DMI UUID。 65 | /// 66 | public String MachineUniqueId { get; } 67 | 68 | /// 69 | /// 机器的用户自定义标识。 70 | /// 71 | public String UserDefinedId { get; } 72 | 73 | /// 74 | /// 机器最后的心跳时间。 75 | /// 76 | public String LastHeartbeatTime { get; } 77 | 78 | public MachineInfo(String ip, String machineUniqueId, String userDefinedId, String lastHeartbeatTime) 79 | { 80 | this.Ip = ip; 81 | this.MachineUniqueId = machineUniqueId; 82 | this.UserDefinedId = userDefinedId; 83 | this.LastHeartbeatTime = lastHeartbeatTime; 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/MachineGroupAttributeInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // MachineGroupAttributeInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.MachineGroup 30 | { 31 | public class MachineGroupAttributeInfo 32 | { 33 | /// 34 | /// 机器分组的 topic,默认为空。 35 | /// 36 | public String GroupTopic { get; set; } 37 | 38 | /// 39 | /// 机器分组所依赖的外部管理标识,默认为空。 40 | /// 41 | public String ExternalName { get; set; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/RemoveConfigFromMachineGroupRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RemoveConfigFromMachineGroupRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Aliyun.Api.LogService.Domain.Project; 29 | 30 | namespace Aliyun.Api.LogService.Domain.MachineGroup 31 | { 32 | public class RemoveConfigFromMachineGroupRequest : ProjectScopedRequest 33 | { 34 | /// 35 | /// 机器分组名称。 36 | /// 37 | public String GroupName { get; } 38 | 39 | /// 40 | /// 日志配置名称。 41 | /// 42 | public String ConfigName { get; } 43 | 44 | public RemoveConfigFromMachineGroupRequest(String groupName, String configName) 45 | { 46 | this.GroupName = groupName; 47 | this.ConfigName = configName; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/MachineGroup/UpdateMachineGroupRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UpdateMachineGroupRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using Aliyun.Api.LogService.Domain.Project; 30 | 31 | namespace Aliyun.Api.LogService.Domain.MachineGroup 32 | { 33 | public class UpdateMachineGroupRequest : ProjectScopedRequest 34 | { 35 | /// 36 | /// 机器分组名称。 37 | /// 38 | public String GroupName { get; } 39 | 40 | /// 41 | /// 机器分组类型,默认为空。 42 | /// 43 | public String GroupType { get; set; } 44 | 45 | /// 46 | /// 机器标识类型,分为 IP 和 userdefined 两种。 47 | /// 48 | public String MachineIdentifyType { get; } 49 | 50 | /// 51 | /// 机器分组的属性,默认为空。 52 | /// 53 | public MachineGroupAttributeInfo GroupAttribute { get; set; } 54 | 55 | /// 56 | /// 具体的机器标识,可以是 IP 或 userdefined-id。 57 | /// 58 | public IEnumerable MachineList { get; } 59 | 60 | public UpdateMachineGroupRequest(String groupName, String machineIdentifyType, IEnumerable machineList) 61 | { 62 | this.GroupName = groupName; 63 | this.MachineIdentifyType = machineIdentifyType; 64 | this.MachineList = machineList; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/CreateProjectRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CreateProjectRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.Project 30 | { 31 | public class CreateProjectRequest 32 | { 33 | /// 34 | /// project的名称,全局唯一。 35 | /// 36 | public String ProjectName { get; } 37 | 38 | /// 39 | /// project描述。 40 | /// 41 | public String ProjectDesc { get; } 42 | 43 | public CreateProjectRequest(String projectName, String projectDesc) 44 | { 45 | this.ProjectName = projectName; 46 | this.ProjectDesc = projectDesc; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/DeleteProjectRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DeleteProjectRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace Aliyun.Api.LogService.Domain.Project 28 | { 29 | public class DeleteProjectRequest : ProjectScopedRequest 30 | { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/GetProjectRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetProjectRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace Aliyun.Api.LogService.Domain.Project 28 | { 29 | public class GetProjectRequest : ProjectScopedRequest 30 | { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/GetProjectResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GetProjectResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace Aliyun.Api.LogService.Domain.Project 28 | { 29 | public class GetProjectResult 30 | { 31 | /// 32 | /// Project信息。 33 | /// 34 | public ProjectDetailInfo Project { get; } 35 | 36 | public GetProjectResult(ProjectDetailInfo project) 37 | { 38 | this.Project = project; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/ListProjectRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListProjectRequest.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.Project 30 | { 31 | public class ListProjectRequest 32 | { 33 | public const Int32 DefaultOffset = 0; 34 | public const Int32 DefaultSize = 500; 35 | 36 | /// 37 | /// 请求结果的起始位置,默认为0。 38 | /// 39 | public Int32 Offset { get; set; } = DefaultOffset; 40 | 41 | /// 42 | /// 每次请求返回结果最大数量,默认500(最大值)。 43 | /// 44 | public Int32 Size { get; set; } = DefaultSize; 45 | 46 | /// 47 | /// 用于过滤返回结果的project名称(支持部分匹配)。 48 | /// 49 | public String ProjectName { get; set; } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/ListProjectResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ListProjectResult.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Project 31 | { 32 | public class ListProjectResult 33 | { 34 | /// 35 | /// 返回project数量。 36 | /// 37 | public Int32 Count { get; } 38 | 39 | /// 40 | /// project总数。 41 | /// 42 | public Int32 Total { get; } 43 | 44 | /// 45 | /// 返回的project属性列表。 46 | /// 47 | public IList Projects { get; } 48 | 49 | public ListProjectResult(Int32 count, Int32 total, IList projects) 50 | { 51 | this.Count = count; 52 | this.Total = total; 53 | this.Projects = projects; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/ProjectDetailInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ProjectDetailInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.Project 30 | { 31 | public class ProjectDetailInfo : ProjectInfo 32 | { 33 | /// 34 | /// Project所在区域。 35 | /// 36 | public String Region { get; } 37 | 38 | /// 39 | /// Project的所有者。 40 | /// 41 | public String Owner { get; } 42 | 43 | /// 44 | /// Project创建时间。 45 | /// 46 | public String CreateTime { get; } 47 | 48 | /// 49 | /// Project最后修改时间。 50 | /// 51 | public String LastModifyTime { get; } 52 | 53 | public ProjectDetailInfo(String projectName, ProjectState status, String description, String region, String owner, String createTime, String lastModifyTime) 54 | : base(projectName, status, description) 55 | { 56 | this.Region = region; 57 | this.Owner = owner; 58 | this.CreateTime = createTime; 59 | this.LastModifyTime = lastModifyTime; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/ProjectInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ProjectInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Domain.Project 30 | { 31 | public class ProjectInfo 32 | { 33 | /// 34 | /// project名称。 35 | /// 36 | public String ProjectName { get; } 37 | 38 | /// 39 | /// project状态,分为"Normal"(正常)和"Disable"(欠费停用)。 40 | /// 41 | public ProjectState Status { get; } 42 | 43 | /// 44 | /// project描述。 45 | /// 46 | public String Description { get; } 47 | 48 | public ProjectInfo(String projectName, ProjectState status, String description) 49 | { 50 | this.ProjectName = projectName; 51 | this.Status = status; 52 | this.Description = description; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/ProjectScopedRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogServiceClientBuilders.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using Newtonsoft.Json; 29 | 30 | namespace Aliyun.Api.LogService.Domain.Project 31 | { 32 | /// 33 | /// 限定在指定Project内的请求,可带有 属性,覆盖 中默认的 Project。 34 | /// 35 | public abstract class ProjectScopedRequest 36 | { 37 | /// 38 | /// 覆盖 中默认的 Project。 39 | /// 40 | [JsonIgnore] 41 | public String ProjectName { get; set; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Domain/Project/ProjectState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ProjectState.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace Aliyun.Api.LogService.Domain.Project 28 | { 29 | public enum ProjectState 30 | { 31 | /// 32 | /// 正常。 33 | /// 34 | Normal, 35 | 36 | /// 37 | /// 欠费停用。 38 | /// 39 | Disable, 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Infrastructure/Authentication/Credential.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogServiceClientBuilders.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Infrastructure.Authentication 30 | { 31 | /// 32 | /// 身份验证凭据。 33 | /// 34 | public class Credential 35 | { 36 | public String AccessKeyId { get; } 37 | 38 | public String AccessKey { get; } 39 | 40 | public String StsToken { get; } 41 | 42 | public Credential(String accessKeyId, String accessKey, String stsToken = null) 43 | { 44 | this.AccessKeyId = accessKeyId; 45 | this.AccessKey = accessKey; 46 | this.StsToken = stsToken; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Infrastructure/Protocol/CompressType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CompressType.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace Aliyun.Api.LogService.Infrastructure.Protocol 28 | { 29 | /// 30 | /// 数据压缩类型。 31 | /// 32 | public enum CompressType 33 | { 34 | /// 35 | /// 无压缩(默认) 36 | /// 37 | None, 38 | 39 | /// 40 | /// 使用标准LZ4压缩方式。 41 | /// 42 | /// 43 | Lz4, 44 | 45 | /// 46 | /// 使用Deflate(Zlib包装,RFC 1950)压缩方式。 47 | /// 48 | /// 49 | /// 50 | Deflate, 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Infrastructure/Protocol/Error.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Error.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace Aliyun.Api.LogService.Infrastructure.Protocol 30 | { 31 | /// 32 | /// 错误信息 33 | /// 34 | public class Error 35 | { 36 | /// 37 | /// 错误码 38 | /// 39 | public ErrorCode ErrorCode { get; } 40 | 41 | /// 42 | /// 错误消息 43 | /// 44 | public String ErrorMessage { get; } 45 | 46 | public Error(ErrorCode errorCode, String errorMessage) 47 | { 48 | this.ErrorCode = errorCode; 49 | this.ErrorMessage = errorMessage; 50 | } 51 | 52 | public override String ToString() 53 | => $"{this.ErrorCode}{(this.ErrorMessage == null ? String.Empty : $" ({this.ErrorMessage})")}"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Infrastructure/Protocol/Http/HttpResponseExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // HttpResponseExtensions.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Net; 30 | using System.Net.Http; 31 | 32 | namespace Aliyun.Api.LogService.Infrastructure.Protocol.Http 33 | { 34 | public static class HttpResponseExtensions 35 | { 36 | private static HttpResponse ToHttpResponse(this IResponse response) 37 | => response is HttpResponse httpResponse 38 | ? httpResponse 39 | : throw new ArgumentException($"response must be [{nameof(HttpResponse)}].", nameof(response)); 40 | 41 | private static HttpResponse ToHttpResponse(this IResponse response) 42 | where T : class 43 | => response is HttpResponse httpResponse 44 | ? httpResponse 45 | : throw new ArgumentException($"response must be [{nameof(HttpResponse)}].", nameof(response)); 46 | 47 | /// 48 | /// 获取此响应对象对应底层的 。 49 | /// 50 | /// 响应对象。 51 | /// 底层的 52 | public static HttpResponseMessage GetHttpResponseMessage(this IResponse response) 53 | { 54 | return response.ToHttpResponse().ResponseMessage; 55 | } 56 | 57 | /// 58 | /// 获取此响应对象对应的 HTTP 响应码。 59 | /// 60 | /// 响应对象。 61 | /// HTTP 响应码。 62 | public static HttpStatusCode GetHttpStatusCode(this IResponse response) 63 | { 64 | return response.ToHttpResponse().StatusCode; 65 | } 66 | 67 | /// 68 | /// 69 | /// 带有结果对象类型的响应消息解释器。 70 | /// 结果转换器。 71 | /// 转换前结果对象类型。 72 | /// 转换后结果对象类型。 73 | /// 异步解释结果。 74 | public static IResponse Transform(this IResponse source, 75 | Func, TSource, TResult> transformer) 76 | where TSource : class 77 | where TResult : class 78 | { 79 | var httpResponse = source.ToHttpResponse(); 80 | var result = transformer(source.Headers, source.Result); 81 | var response = new HttpResponse(httpResponse.ResponseMessage, httpResponse.IsSuccess, httpResponse.StatusCode, httpResponse.RequestId, httpResponse.Headers, result); 82 | return response; 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Infrastructure/Protocol/SerializeType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SerializeType.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace Aliyun.Api.LogService.Infrastructure.Protocol 28 | { 29 | /// 30 | /// 序列化类型。 31 | /// 32 | public enum SerializeType 33 | { 34 | /// 35 | /// Json(默认)。 36 | /// 37 | /// 38 | Json, 39 | 40 | /// 41 | /// Google Protocol Buffers 42 | /// 43 | /// 44 | Protobuf, 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Infrastructure/Protocol/SignatureType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SignatureType.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace Aliyun.Api.LogService.Infrastructure.Protocol 28 | { 29 | /// 30 | /// 签名类型。 31 | /// 32 | public enum SignatureType 33 | { 34 | /// 35 | /// HMAC-SHA1签名。 36 | /// 37 | HmacSha1, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Infrastructure/Serialization/Protobuf/Log.proto: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Compile command: 3 | * $ protoc --csharp_out=. --csharp_opt=file_extension=.Generated.cs Log.proto 4 | ******************************************************************************/ 5 | 6 | syntax = "proto3"; 7 | option csharp_namespace = "Aliyun.Api.LogService.Infrastructure.Serialization.Protobuf"; 8 | 9 | package aliyun.api.log.infrastructure.serialization.protobuf; 10 | 11 | message Log 12 | { 13 | uint32 Time = 1;// UNIX Time Format 14 | message Content 15 | { 16 | string Key = 1; 17 | string Value = 2; 18 | } 19 | repeated Content Contents= 2; 20 | 21 | } 22 | message LogTag 23 | { 24 | string Key = 1; 25 | string Value = 2; 26 | } 27 | message LogGroup 28 | { 29 | repeated Log Logs= 1; 30 | string Reserved = 2; // reserved fields 31 | string Topic = 3; 32 | string Source = 4; 33 | repeated LogTag LogTags = 6; 34 | } 35 | 36 | message LogGroupList 37 | { 38 | repeated LogGroup logGroupList = 1; 39 | } 40 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/LogServiceClientBuilders.cs: -------------------------------------------------------------------------------- 1 | // 2 | // LogServiceClientBuilders.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using Aliyun.Api.LogService.Infrastructure.Protocol.Http; 28 | 29 | namespace Aliyun.Api.LogService 30 | { 31 | /// 32 | /// 实现类构建器。 33 | /// 34 | public static class LogServiceClientBuilders 35 | { 36 | /// 37 | /// 实现 HTTP 协议的构建器。 38 | /// 39 | public static HttpLogServiceClientBuilder HttpBuilder 40 | => new HttpLogServiceClientBuilder(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Reflection; 29 | using System.Runtime.CompilerServices; 30 | using Aliyun.Api.LogService.Properties; 31 | 32 | // Information about this assembly is defined by the following attributes. 33 | // Change them to the values specific to your project. 34 | 35 | [assembly: AssemblyTitle("Aliyun.Api.Log")] 36 | [assembly: AssemblyDescription("")] 37 | [assembly: AssemblyConfiguration("")] 38 | [assembly: AssemblyCompany("Alibaba Cloud")] 39 | [assembly: AssemblyProduct("")] 40 | [assembly: AssemblyCopyright("Copyright (c) 2018 Alibaba Cloud")] 41 | [assembly: AssemblyTrademark("")] 42 | [assembly: AssemblyCulture("")] 43 | 44 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 45 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 46 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 47 | 48 | [assembly: AssemblyVersion("1.1.1")] 49 | 50 | // The following attributes are used to specify the signing key for the assembly, 51 | // if desired. See the Mono documentation for more information about signing. 52 | 53 | //[assembly: AssemblyDelaySign(false)] 54 | //[assembly: AssemblyKeyFile("")] 55 | 56 | [assembly: InternalsVisibleTo("Aliyun.Api.LogService.Tests, PublicKey=" + AssemblyInfo.PublicKey)] 57 | 58 | namespace Aliyun.Api.LogService.Properties 59 | { 60 | internal static class AssemblyInfo 61 | { 62 | internal const String PublicKey = @"0024000004800000940000000602000000240000525341310004000001000100a726f8dd71d3de90991d084fc20c20e0078a4956f6d66d4f7cc1f0708c967d8053f482ecbeed7bbca78a33186b6be7244b493a04357f68af17c643c4f61ee142e8267d3f197a57268a24212c5436cdb0df54dbf91caa7f3b41702689ece692c0c90a48e5e3ff692766f63689ceae2346ef09e6e938a690e4b3c1dfc43c30938c"; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Utils/CommonExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CommonExtensions.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Collections.Specialized; 30 | using System.Linq; 31 | 32 | namespace Aliyun.Api.LogService.Utils 33 | { 34 | internal static class CommonExtensions 35 | { 36 | internal static Boolean IsEmpty(this String source) 37 | { 38 | return String.IsNullOrEmpty(source); 39 | } 40 | 41 | internal static Boolean IsNotEmpty(this String source) 42 | { 43 | return !String.IsNullOrEmpty(source); 44 | } 45 | 46 | internal static Boolean IsEmpty(this T[] source) 47 | { 48 | return source == null || source.Length == 0; 49 | } 50 | 51 | internal static Boolean IsNotEmpty(this T[] source) 52 | { 53 | return source != null && source.Length != 0; 54 | } 55 | 56 | internal static Boolean IsEmpty(this IEnumerable source) 57 | { 58 | return source == null || !source.Any(); 59 | } 60 | 61 | internal static Boolean IsNotEmpty(this IEnumerable source) 62 | { 63 | return source != null && source.Any(); 64 | } 65 | 66 | internal static IEnumerable> ToEnumerable(this NameValueCollection source) 67 | { 68 | return source.AllKeys 69 | .SelectMany(key => source.GetValues(key), (key, value) => new KeyValuePair(key, value)); 70 | } 71 | 72 | /// 73 | /// Freeze the IEnumerable to avoid re-evaluating on . 74 | /// 75 | /// The source to freeze. 76 | /// The item type in source. 77 | /// If source has already frozen, return itself; otherwize will be applied. 78 | internal static IEnumerable Freeze(this IEnumerable source) 79 | { 80 | switch (source) 81 | { 82 | case null: 83 | case Array _: 84 | case ICollection _: 85 | case IReadOnlyCollection _: 86 | { 87 | return source; 88 | } 89 | 90 | default: 91 | { 92 | return source.ToArray(); 93 | } 94 | } 95 | } 96 | 97 | internal static TValue GetValueOrDefault(this IDictionary source, TKey key) 98 | { 99 | if (source == null) 100 | { 101 | return default; 102 | } 103 | 104 | return source.TryGetValue(key, out var value) ? value : default; 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Utils/Constants.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Constants.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Reflection; 29 | 30 | namespace Aliyun.Api.LogService.Utils 31 | { 32 | internal static class Constants 33 | { 34 | internal static String AssemblyVersion { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Aliyun.Api.LogService/Utils/Ensure.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Ensure.cs 3 | // 4 | // Author: 5 | // MiNG 6 | // 7 | // Copyright (c) 2018 Alibaba Cloud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | 30 | namespace Aliyun.Api.LogService.Utils 31 | { 32 | internal static class Ensure 33 | { 34 | internal static void NotNull(Object source, String name) 35 | { 36 | if (source == null) 37 | { 38 | throw new ArgumentNullException(name); 39 | } 40 | } 41 | 42 | internal static void NotEmpty(String source, String name) 43 | { 44 | if (source.IsEmpty()) 45 | { 46 | throw new ArgumentException(name, "Argument cannot be empty string."); 47 | } 48 | } 49 | 50 | internal static void NotEmpty(T[] source, String name) 51 | { 52 | if (source.IsEmpty()) 53 | { 54 | throw new ArgumentException(name, "Argument cannot be empty array."); 55 | } 56 | } 57 | 58 | internal static void NotEmpty(ICollection source, String name) 59 | { 60 | if (source.IsEmpty()) 61 | { 62 | throw new ArgumentException(name, "Argument cannot be empty collection."); 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Aliyun LogServie SDK for .NET Core 2 | 3 | ## 1.1.1 4 | 5 | ### 变更内容 6 | 7 | - 修复查询语句中包含特殊字符未转义bug 8 | - 为访问的域名增加project 前缀 9 | - 重命名包为 Aliyun.SLS.SDK 10 | 11 | 12 | ## 1.1.0 13 | 14 | ### 变更内容 15 | 16 | - 修正proto3生成的stub对空字符串的处理在proto2中无法读取的问题(#4) 17 | - 添加所有已知响应头(Response Header)的读取扩展方法[LogHeaderExtensions](Aliyun.Api.LogService/Infrastructure/Protocol/Http/LogHeaderExtensions.cs) 18 | + PullLogs 19 | - x-log-cursor 20 | - x-log-count 21 | - x-log-compresstype 22 | - x-log-bodyrawsize 23 | + GetLogs 24 | - x-log-progress 25 | - x-log-count 26 | - x-log-processedrows 27 | - x-log-elapsedmillisecond 28 | - x-log-queryinfo 29 | - x-log-hassql 30 | - x-log-aggquery 31 | - x-log-wherequery 32 | + GetHistograms 33 | - x-log-count 34 | - x-log-progress 35 | 36 | 37 | ## 1.0.1 38 | 39 | ### 变更内容 40 | 41 | - 依赖变更: [DotNetZip • 1.10.1](https://www.nuget.org/packages/DotNetZip/1.10.1) -> [Iconic.Zlib.NetStandard • 1.0.0](https://www.nuget.org/packages/Iconic.Zlib.Netstandard/1.0.0) ( Iconic.Zlib.NetStandard 为 DotNetZip 的 Zlib 功能的 NetStandard 编译版本) 42 | 43 | ## 1.0.0 44 | 45 | ### 变更内容 46 | 47 | - 支持阿里云 [LogService REST API](https://help.aliyun.com/document_detail/29007.html) ; 48 | - 所有接口均支持异步请求; 49 | - 支持基于 .NetStandard 2.0 的平台; 50 | - 支持 Zlib 压缩/解压缩; 51 | - 支持 Lz4 压缩/解压缩; 52 | - 支持[HMAC-SHA1签名](https://help.aliyun.com/document_detail/29012.html); 53 | - 支持[RAM访问方式](https://help.aliyun.com/document_detail/29049.html); 54 | - 支持[STS访问方式](https://help.aliyun.com/document_detail/47277.html); 55 | - 此版本支持接口: 56 | + CreateLogStore 57 | + DeleteLogStore 58 | + UpdateLogStore 59 | + GetLogStore 60 | + ListLogStore 61 | + ListShards 62 | + SplitShard 63 | + MergeShards 64 | + GetCursor 65 | + GetShipperStatus 66 | + RetryShipperTask 67 | + Create 68 | + PostLogStoreLogs 69 | + PullLogs 70 | + GetLogs 71 | + GetProjectLogs 72 | + GetHistograms 73 | + CreateMachineGroup 74 | + DeleteMachineGroup 75 | + UpdateMachineGroup 76 | + ListMachineGroup 77 | + GetMachineGroup 78 | + ApplyConfigToMachineGroup 79 | + RemoveConfigFromMachineGroup 80 | + ListMachines 81 | + GetAppliedConfigs 82 | + CreateConfig 83 | + ListConfig 84 | + GetAppliedMachineGroups 85 | + GetConfig 86 | + DeleteConfig 87 | + UpdateConfig 88 | + CreateProject 89 | + ListProject 90 | + GetProject 91 | + DeleteProject 92 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Alibaba Cloud 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | -------------------------------------------------------------------------------- /aliyun-log-dotnetcore-sdk.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyun/aliyun-log-dotnetcore-sdk/037a3a3c203f2aa0a72f226e7ac62715367d9165/aliyun-log-dotnetcore-sdk.snk -------------------------------------------------------------------------------- /docs/put-docs-here: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyun/aliyun-log-dotnetcore-sdk/037a3a3c203f2aa0a72f226e7ac62715367d9165/docs/put-docs-here --------------------------------------------------------------------------------