public async void passwordreset([FromBody] Users u) { Users a = _context.Users.Find(u.Email); _log.LogInformation("Listing all items"); Console.WriteLine("Hello inside the reset"); if (a != null) { var client = new AmazonSimpleNotificationServiceClient(RegionEndpoint.USEast1); var request = new ListTopicsRequest(); var response = new ListTopicsResponse(); _log.LogInformation("going inside for"); response = await client.ListTopicsAsync(); foreach (var topic in response.Topics) { _log.LogInformation(topic.TopicArn); if (topic.TopicArn.EndsWith("SNSTopicResetPassword")) { _log.LogInformation(topic.TopicArn); var respose = new PublishRequest { TopicArn = topic.TopicArn, Message = a.Email }; await client.PublishAsync(respose); } } } }
/// <summary> /// Notification configuration window load event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NcWindow_Loaded(object sender, RoutedEventArgs e) { try { AmazonAutoScalingConfig config = new AmazonAutoScalingConfig(); config.ServiceURL = ((ViewModel)this.DataContext).Region.Url; AmazonAutoScalingClient client = new AmazonAutoScalingClient(config); DescribeAutoScalingNotificationTypesRequest dasntreq = new DescribeAutoScalingNotificationTypesRequest(); DescribeAutoScalingNotificationTypesResponse dasntresp = client.DescribeAutoScalingNotificationTypes(dasntreq); foreach (string asnt in dasntresp.DescribeAutoScalingNotificationTypesResult.AutoScalingNotificationTypes) { this.notificationTypes.Add(asnt); } AmazonSimpleNotificationServiceConfig snsconfig = new AmazonSimpleNotificationServiceConfig(); config.ServiceURL = ((ViewModel)this.DataContext).Region.Url; AmazonSimpleNotificationServiceClient snsclient = new AmazonSimpleNotificationServiceClient(snsconfig); ListTopicsRequest ltrequest = new ListTopicsRequest(); ListTopicsResponse ltresp = snsclient.ListTopics(ltrequest); foreach (Topic topic in ltresp.ListTopicsResult.Topics) { this.snstopics.Add(topic.TopicArn); } rlbNcTypes.ItemsSource = this.notificationTypes; cboTopics.ItemsSource = this.snstopics; } catch { MessageBox.Show(Window.GetWindow(this), "Error occured while loading the notification configuration options.", "Error", MessageBoxButton.OK); this.Close(); } }
public async Task <IReadOnlyList <TopicDetail> > GetAllTopicsAsync() { var topics = new List <TopicDetail>(); var request = new ListTopicsRequest(); ListTopicsResponse response = null; do { response = await _sns.ListTopicsAsync(request); if (response.HttpStatusCode != HttpStatusCode.OK) { throw new InvalidOperationException($"Unable to list all topics."); } foreach (var topic in response.Topics) { var topicArn = new TopicArn(topic.TopicArn); topics.Add(new TopicDetail { Attributes = await GetTopicAttributesAsync(topic.TopicArn), Name = topicArn.TopicName, Region = topicArn.Region }); } request.NextToken = response.NextToken; } while (response.NextToken != null); return(topics); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { ListTopicsResponse response = new ListTopicsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("ListTopicsResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListTopicsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Topics/member", targetDepth)) { var unmarshaller = TopicUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Topics.Add(item); continue; } } } return; }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonSimpleNotificationServiceConfig config = new AmazonSimpleNotificationServiceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonSimpleNotificationServiceClient client = new AmazonSimpleNotificationServiceClient(creds, config); ListTopicsResponse resp = new ListTopicsResponse(); do { ListTopicsRequest req = new ListTopicsRequest { NextToken = resp.NextToken }; resp = client.ListTopics(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Topics) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
protected override void ProcessRecord() { if (Topic != null && Topic.Length > 0) { foreach (string topicName in Topic) { string formattedTopicName = GetProjectPrefixForTopic(topicName, Project); try { ProjectsResource.TopicsResource.GetRequest getRequest = Service.Projects.Topics.Get(formattedTopicName); WriteObject(getRequest.Execute()); } catch (GoogleApiException ex) when(ex.HttpStatusCode == HttpStatusCode.NotFound) { WriteResourceMissingError( exceptionMessage: $"Topic '{topicName}' does not exist in project '{Project}'.", errorId: "TopicNotFound", targetObject: topicName); } } } else { ProjectsResource.TopicsResource.ListRequest listRequest = Service.Projects.Topics.List($"projects/{Project}"); do { ListTopicsResponse response = listRequest.Execute(); if (response.Topics != null) { WriteObject(response.Topics, true); } listRequest.PageToken = response.NextPageToken; }while (!Stopping && listRequest.PageToken != null); } }
public string GetTopic(string topic) { ListTopicsResponse tmp = client.ListTopics(); //on va storer le arn dans la db pour le moment si le topic existe ça retourne le topic sinon le crée CreateTopicResponse x = client.CreateTopic(topic); return(x.TopicArn); }
public async Task GetAWSTopics(AWSCredentials credentials) { var client = new AmazonSimpleNotificationServiceClient(credentials.AccessKey, credentials.SecretKey, credentials.Region); var request = new ListTopicsRequest(); var response = new ListTopicsResponse(); do { response = await client.ListTopicsAsync(request); foreach (var topic in response.Topics) { Console.WriteLine("Topic: {0}", topic.TopicArn); await SendAWSNotification(credentials, topic.TopicArn, String.Format("Message from topic: {0}", topic.TopicArn)); var subs = await client.ListSubscriptionsByTopicAsync( new ListSubscriptionsByTopicRequest { TopicArn = topic.TopicArn }); var ss = subs.Subscriptions; if (ss.Any()) { Console.WriteLine(" Subscriptions:"); foreach (var sub in ss) { Console.WriteLine(" {0}", sub.SubscriptionArn); } } var attrs = await client.GetTopicAttributesAsync( new GetTopicAttributesRequest { TopicArn = topic.TopicArn }); if (attrs.Attributes.Any()) { Console.WriteLine(" Attributes:"); foreach (var attr in attrs.Attributes) { Console.WriteLine(" {0} = {1}", attr.Key, attr.Value); } } Console.WriteLine(); } request.NextToken = response.NextToken; } while (!string.IsNullOrEmpty(response.NextToken)); }
public async System.Threading.Tasks.Task <ListTopicsResponse> GetTopicsAsync() { ListTopicsResponse listTopics = new ListTopicsResponse(); using (AmazonSimpleNotificationServiceClient snsClient = new AmazonSimpleNotificationServiceClient(credentials, Amazon.RegionEndpoint.USEast2)) { ListTagsForResourceRequest request = new ListTagsForResourceRequest(); listTopics = await snsClient.ListTopicsAsync(); } return(listTopics); }
private IEnumerable <string> GetTopicsArns() { var topics = new List <Topic>(); string nextToken = null; do { ListTopicsResponse response = _client.ListTopics(new ListTopicsRequest(nextToken)); topics.AddRange(response.Topics); nextToken = response.NextToken; } while (nextToken != null); return(topics.Select(x => x.TopicArn)); }
private static List <Topic> GetAllTopics(RegionEndpoint regionEndpoint, string topicName) { var client = AWSClientFactory.CreateAmazonSimpleNotificationServiceClient(regionEndpoint); var topics = new List <Topic>(); string nextToken = null; do { ListTopicsResponse topicsResponse = client.ListTopics(new ListTopicsRequest { NextToken = nextToken }); nextToken = topicsResponse.NextToken; topics.AddRange(topicsResponse.Topics); } while (nextToken != null); return(topics.Where(x => x.TopicArn.IndexOf(topicName, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList()); }
private bool IsTopicExists(AmazonSimpleNotificationServiceClient client, string Topic, out string TopicArn) { ListTopicsRequest lstTopicRequest = new ListTopicsRequest(); ListTopicsResponse lstTopicResponse = client.ListTopics(lstTopicRequest); ListTopicsResult lstTopicResult = lstTopicResponse.ListTopicsResult; List <Topic> TopicsList = lstTopicResult.Topics; TopicArn = string.Empty; bool IsTopicExists = TopicsList.Exists(x => x.TopicArn.Split(':')[x.TopicArn.Split(':').Count() - 1] == Topic); if (IsTopicExists) { string topicarn = TopicsList.Where(x => x.IsSetTopicArn() & x.TopicArn.Split(':')[x.TopicArn.Split(':').Count() - 1] == Topic).Select(s => s.TopicArn).First(); TopicArn = topicarn; } return(IsTopicExists); }
public static async Task DeleteAllTopicsWithPrefix(IAmazonSimpleNotificationService snsClient, string topicNamePrefix) { var deletedTopicArns = new HashSet <string>(StringComparer.Ordinal); try { ListTopicsResponse upToHundredTopics = null; do { upToHundredTopics = await snsClient.ListTopicsAsync(upToHundredTopics?.NextToken); // if everything returned here has already been deleted it is probably a good time to stop trying due to the eventual consistency if (upToHundredTopics.Topics.All(topic => deletedTopicArns.Contains(topic.TopicArn))) { return; } var deletionTasks = new List <Task>(upToHundredTopics.Topics.Count); deletionTasks.AddRange(upToHundredTopics.Topics .Where(topic => !deletedTopicArns.Contains(topic.TopicArn)) .Select(async topic => { if (!topic.TopicArn.Contains($":{topicNamePrefix}")) { return; } try { await snsClient.DeleteTopicAsync(topic.TopicArn).ConfigureAwait(false); deletedTopicArns.Add(topic.TopicArn); } catch (Exception) { Console.WriteLine($"Unable to delete topic '{topic.TopicArn}'"); } })); await Task.WhenAll(deletionTasks).ConfigureAwait(false); } while (upToHundredTopics.NextToken != null && upToHundredTopics.Topics.Count > 0); } catch (Exception) { Console.WriteLine($"Unable to delete topics with prefix '{topicNamePrefix}'"); } }
public void TestListTopicWithoutNextToken() { LogClient client = new LogClient(ClientTestData.TEST_ENDPOINT, ClientTestData.TEST_ACCESSKEYID, ClientTestData.TEST_ACCESSKEY); client.SetWebSend(MockSend); ListTopicsRequest request = new ListTopicsRequest(); request.Project = ClientTestData.TEST_PROJECT; request.Logstore = "testlogstore_without_nexttoken"; request.Token = "atoken"; request.Lines = 100; ListTopicsResponse response = client.ListTopics(request);; Assert.IsTrue(DicToString(Headers).CompareTo("[x-sls-apiversion:0.4.0][x-sls-bodyrawsize:0][x-sls-signaturemethod:hmac-sha1][User-Agent:aliyun-sdk-dotnet/1.0.0.0]") == 0); Assert.IsTrue(response != null && response.Count == 2); Assert.IsTrue(Host.CompareTo("mock_project.mockhost.aliyuncs.com") == 0); Assert.IsTrue(RequestUri.CompareTo("http://mock_project.mockhost.aliyuncs.com/logstores/testlogstore_without_nexttoken?type=topic&token=atoken&line=100") == 0); }
/// <summary> /// List the SNS Topics. /// </summary> /// <param name="nextToken"></param> /// <returns></returns> public string[] ListTopics(string nextToken) { ListTopicsRequest request = new ListTopicsRequest(); request.NextToken = nextToken; ListTopicsResponse response = Client.ListTopics(request); var topics = new List <string>(); foreach (Topic topic in response.ListTopicsResult.Topics) { Debug.WriteLine(topic.TopicArn, "TopicArn"); topics.Add(topic.TopicArn); } Debug.WriteLine(response.ListTopicsResult.NextToken, "NextToken"); return(topics.ToArray()); }
public static ListTopicsResponse Unmarshall(UnmarshallerContext context) { ListTopicsResponse listTopicsResponse = new ListTopicsResponse(); listTopicsResponse.HttpResponse = context.HttpResponse; listTopicsResponse.Success = context.BooleanValue("ListTopics.Success"); listTopicsResponse.ErrorCode = context.StringValue("ListTopics.ErrorCode"); listTopicsResponse.ErrorMessage = context.StringValue("ListTopics.ErrorMessage"); listTopicsResponse.HttpStatusCode = context.IntegerValue("ListTopics.HttpStatusCode"); listTopicsResponse.RequestId = context.StringValue("ListTopics.RequestId"); ListTopicsResponse.ListTopics_Data data = new ListTopicsResponse.ListTopics_Data(); data.PageNumber = context.IntegerValue("ListTopics.Data.PageNumber"); data.PageSize = context.IntegerValue("ListTopics.Data.PageSize"); data.TotalCount = context.IntegerValue("ListTopics.Data.TotalCount"); List <ListTopicsResponse.ListTopics_Data.ListTopics_TopicsItem> data_topics = new List <ListTopicsResponse.ListTopics_Data.ListTopics_TopicsItem>(); for (int i = 0; i < context.Length("ListTopics.Data.Topics.Length"); i++) { ListTopicsResponse.ListTopics_Data.ListTopics_TopicsItem topicsItem = new ListTopicsResponse.ListTopics_Data.ListTopics_TopicsItem(); topicsItem.TopicId = context.LongValue("ListTopics.Data.Topics[" + i + "].TopicId"); topicsItem.TopicName = context.StringValue("ListTopics.Data.Topics[" + i + "].TopicName"); topicsItem.TopicStatus = context.StringValue("ListTopics.Data.Topics[" + i + "].TopicStatus"); topicsItem.TopicType = context.StringValue("ListTopics.Data.Topics[" + i + "].TopicType"); topicsItem.AddTime = context.LongValue("ListTopics.Data.Topics[" + i + "].AddTime"); topicsItem.HappenTime = context.LongValue("ListTopics.Data.Topics[" + i + "].HappenTime"); topicsItem.FixTime = context.LongValue("ListTopics.Data.Topics[" + i + "].FixTime"); topicsItem.InstanceId = context.LongValue("ListTopics.Data.Topics[" + i + "].InstanceId"); topicsItem.NodeId = context.LongValue("ListTopics.Data.Topics[" + i + "].NodeId"); topicsItem.NodeName = context.StringValue("ListTopics.Data.Topics[" + i + "].NodeName"); topicsItem.NodeOwner = context.StringValue("ListTopics.Data.Topics[" + i + "].NodeOwner"); topicsItem.ProjectId = context.LongValue("ListTopics.Data.Topics[" + i + "].ProjectId"); data_topics.Add(topicsItem); } data.Topics = data_topics; listTopicsResponse.Data = data; return(listTopicsResponse); }
/// <summary> /// Get the topics in the logtstore /// </summary> /// <param name="request">The list topics request</param> /// <exception>LogException</exception> /// <returns>The List topics response</returns> public ListTopicsResponse ListTopics(ListTopicsRequest request) { ServiceRequest sReq = new ServiceRequest(); sReq.Method = HttpMethod.Get; sReq.Endpoint = BuildReqEndpoint(request); //use empty string to replace Logstore if not set by user explicitly string logstore = request.IsSetLogstore() ? request.Logstore : String.Empty; sReq.ResourcePath = LogConsts.RESOURCE_LOGSTORES + LogConsts.RESOURCE_SEPARATOR + logstore; FillCommonHeaders(sReq); FillCommonParameters(sReq); sReq.Parameters.Add(LogConsts.PARAMETER_TYPE, LogConsts.RESOURCE_TOPIC); if (request.IsSetToken()) { sReq.Parameters.Add(LogConsts.PARAMETER_TOKEN, request.Token); } if (request.IsSetLines()) { sReq.Parameters.Add(LogConsts.PARAMETER_LINES, request.Lines.ToString()); } ExecutionContext context = new ExecutionContext(); context.Signer = new LogRequestSigner(sReq.ResourcePath, HttpMethod.Get); context.Credentials = new ServiceCredentials(this.AccessKeyId, this.AccessKey); using (ServiceResponse response = serviceClient.Send(sReq, context)) { LogClientTools.ResponseErrorCheck(response, context.Credentials); JArray body = LogClientTools.ParserResponseToJArray(response.Content); ListTopicsResponse res = new ListTopicsResponse(response.Headers, body); return(res); } }
/// <summary> /// 查询topics列表 /// </summary> public void ListTopics() { // 设置请求对象 ListTopicsRequest request = new ListTopicsRequest { Limit = 10, Offset = 0, }; try { // 发送请求并返回响应 ListTopicsResponse response = smnClient.SendRequest(request); Console.WriteLine("{0}", response); Console.ReadLine(); } catch (Exception e) { // 处理异常 Console.WriteLine("{0}", e.Message); } }
public void SingleResponse() { string projectId = _fixture.ProjectId; // Sample: SingleResponse PublisherClient client = PublisherClient.Create(); ProjectName projectName = new ProjectName(projectId); PagedEnumerable <ListTopicsResponse, Topic> topics = client.ListTopics(projectName, pageSize: 3); IEnumerable <ListTopicsResponse> topicResponses = topics.AsRawResponses(); // This is just the regular LINQ First() method. The sequence of pages will never be empty, // but the page may have no resources. ListTopicsResponse firstResponse = topicResponses.First(); Console.WriteLine("Topics in response:"); foreach (Topic topic in firstResponse.Topics) { Console.WriteLine($" {topic.Name}"); } // If you were processing items in batches, you might wish to store this // in order to recover from failures. The page token can be passed into the ListTopics method. Console.WriteLine($"Next page token: {firstResponse.NextPageToken}"); // End sample }
public bool DoesExist() { ListTopicsResponse response = Client.ListTopics(new ListTopicsRequest()); if (response.HttpStatusCode != HttpStatusCode.OK) { throw new MessagingException(String.Format( "An error occurred while attempting to determine whether the specified topic exists. AWS returned status code [{0}].", response.HttpStatusCode)); } if ((response.Topics == null) || (response.Topics.Count == 0)) { return(false); } return (response .Topics .Select(t => t.TopicArn) .Any(a => (String.Compare(a, endpoint.TopicArn, StringComparison.InvariantCultureIgnoreCase) == 0))); }
public static void SNSListTopics() { #region SNSListTopics var snsClient = new AmazonSimpleNotificationServiceClient(); var request = new ListTopicsRequest(); var response = new ListTopicsResponse(); do { response = snsClient.ListTopics(request); foreach (var topic in response.Topics) { Console.WriteLine("Topic: {0}", topic.TopicArn); var attrs = snsClient.GetTopicAttributes( new GetTopicAttributesRequest { TopicArn = topic.TopicArn }).Attributes; if (attrs.Count > 0) { foreach (var attr in attrs) { Console.WriteLine(" -{0} : {1}", attr.Key, attr.Value); } } Console.WriteLine(); } request.NextToken = response.NextToken; } while (!string.IsNullOrEmpty(response.NextToken)); #endregion Console.ReadLine(); }
public async Task TestGetTopicListAsyncException() { var responses = new ListTopicsResponse[0]; PubsubService service = GetMockedService( (PubsubService s) => s.Projects, p => p.Topics, t => t.List(It.IsAny <string>()), responses); var sourceUnderTest = new PubsubDataSource(service, ProjectName); try { await sourceUnderTest.GetTopicListAsync(); Assert.Fail(); } finally { var topicsMock = Mock.Get(service.Projects.Topics); topicsMock.Verify(t => t.List(ProjectResourceName), Times.AtLeastOnce); topicsMock.Verify(t => t.List(It.IsNotIn(ProjectResourceName)), Times.Never); } }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListTopicsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Topics/member", targetDepth)) { response.Topics.Add(TopicUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("NextToken", targetDepth)) { response.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
public AmazonSmsService(bool live) { IsLive = live; //Authenticate(); CredentialProfileStoreChain chain = new CredentialProfileStoreChain(); AWSCredentials awsCredentials; if (!(chain.TryGetAWSCredentials("basic_profile", out awsCredentials))) { /* * on ne roule ca qu'une fois car sa sentre en .net (pas sur de comprendre ou) */ Authenticate(); if (!(chain.TryGetAWSCredentials("basic_profile", out awsCredentials))) { return; } } client = new AmazonSimpleNotificationServiceClient(awsCredentials, Amazon.RegionEndpoint.USEast1); request = new ListTopicsRequest(); response = new ListTopicsResponse(); }
public void FT() { LogClient client = new LogClient("sls-failover.alibaba-inc.com", "", ""); uint topicFlag = DateUtils.TimeSpan(); int PUT_COUNT = 20, TOPIC_COUNT = 10, LOGITEM_COUNT = 20, CONTENT_COUNT = 10, SLEEP_INTERVAL = 2, SLEEP_TIME = 500; for (int j = 1; j <= PUT_COUNT; ++j) { PutLogsRequest putLogsReqError = new PutLogsRequest(); putLogsReqError.Project = "ali-winlogtail-project"; putLogsReqError.Topic = "dotnet_topic_" + topicFlag + "_" + (j % TOPIC_COUNT); putLogsReqError.Logstore = "sls-logstore-002"; putLogsReqError.LogItems = new List <LogItem>(); for (int i = 1; i <= LOGITEM_COUNT; ++i) { LogItem logItem = new LogItem(); logItem.Time = (uint)(topicFlag + j); for (int k = 0; k < CONTENT_COUNT; ++k) { logItem.PushBack("error_" + (j % TOPIC_COUNT) + "_" + k, "invalid operation: " + i * j); } putLogsReqError.LogItems.Add(logItem); } PutLogsResponse putLogRespError = client.PutLogs(putLogsReqError); if (j % SLEEP_INTERVAL == 0) { Thread.Sleep(SLEEP_TIME); } } Thread.Sleep(50 * 1000); ListLogstoresRequest req = new ListLogstoresRequest(); req.Project = "ali-winlogtail-project"; ListLogstoresResponse res = client.ListLogstores(req); HashSet <String> logstoresSet = new HashSet <string>(res.Logstores); Assert.IsTrue(logstoresSet.Contains("sls-logstore-002")); ListTopicsRequest topicReq = new ListTopicsRequest(); topicReq.Project = "ali-winlogtail-project"; topicReq.Logstore = "sls-logstore-002"; topicReq.Lines = TOPIC_COUNT; topicReq.Token = "dotnet_topic_" + topicFlag + "_"; ListTopicsResponse lstTopicsRequest = client.ListTopics(topicReq); Assert.IsTrue(lstTopicsRequest.Count >= TOPIC_COUNT); HashSet <String> topicSet = new HashSet <string>(lstTopicsRequest.Topics); for (int i = 0; i < TOPIC_COUNT; ++i) { Assert.IsTrue(topicSet.Contains("dotnet_topic_" + topicFlag + "_" + i)); } Thread.Sleep(SLEEP_TIME); for (int i = 0; i < TOPIC_COUNT; ++i) { GetHistogramsRequest histReq = new GetHistogramsRequest(); histReq.Project = "ali-winlogtail-project"; histReq.Logstore = "sls-logstore-002"; histReq.Topic = "dotnet_topic_" + topicFlag + "_" + i; histReq.To = (uint)(topicFlag + PUT_COUNT + 1); histReq.From = (uint)topicFlag; GetHistogramsResponse histResp = client.GetHistograms(histReq); Assert.IsTrue(histResp.TotalCount == (PUT_COUNT / TOPIC_COUNT) * LOGITEM_COUNT); if ((i + 1) % SLEEP_INTERVAL == 0) { Thread.Sleep(SLEEP_TIME); } } Thread.Sleep(SLEEP_TIME); for (int i = 0; i < TOPIC_COUNT; ++i) { for (int k = 0; k < 2; ++k) { GetHistogramsRequest histReq = new GetHistogramsRequest(); histReq.Project = "ali-winlogtail-project"; histReq.Logstore = "sls-logstore-002"; histReq.Topic = "dotnet_topic_" + topicFlag + "_" + i; histReq.Query = "error_" + i + "_" + k; histReq.To = (uint)(topicFlag + PUT_COUNT + 1); histReq.From = (uint)topicFlag; GetHistogramsResponse histResp = client.GetHistograms(histReq); Assert.IsTrue(histResp.TotalCount == (PUT_COUNT / TOPIC_COUNT) * LOGITEM_COUNT); if ((k + 1) * (i + 1) % SLEEP_INTERVAL == 0) { Thread.Sleep(SLEEP_TIME); } } } Thread.Sleep(SLEEP_TIME); for (int i = 0; i < TOPIC_COUNT; ++i) { GetLogsRequest getLogsReq = new GetLogsRequest(); getLogsReq.Project = "ali-winlogtail-project"; getLogsReq.Logstore = "sls-logstore-002"; getLogsReq.Topic = "dotnet_topic_" + topicFlag + "_" + i; getLogsReq.Lines = 120; getLogsReq.To = (uint)(topicFlag + PUT_COUNT + 1); getLogsReq.From = (uint)topicFlag; GetLogsResponse getLogsResp = client.GetLogs(getLogsReq); Assert.IsTrue(getLogsResp.Count == (PUT_COUNT / TOPIC_COUNT) * LOGITEM_COUNT); String logs = getLogsResp.Print(); for (int m = 0; m < CONTENT_COUNT; ++m) { String dstStr = "error_" + i + "_" + m; Assert.IsTrue(ChildStringOccurTimes(logs, dstStr) == getLogsResp.Count); } if ((i + 1) % SLEEP_INTERVAL == 0) { Thread.Sleep(SLEEP_TIME); } } Thread.Sleep(SLEEP_TIME); for (int i = 0; i < TOPIC_COUNT; ++i) { for (int k = 0; k < 2; ++k) { GetLogsRequest getLogsReq = new GetLogsRequest(); getLogsReq.Project = "ali-winlogtail-project"; getLogsReq.Logstore = "sls-logstore-002"; getLogsReq.Topic = "dotnet_topic_" + topicFlag + "_" + i; getLogsReq.Query = "error_" + i + "_" + k; getLogsReq.Lines = 120; getLogsReq.To = (uint)(topicFlag + PUT_COUNT + 1); getLogsReq.From = (uint)topicFlag; GetLogsResponse getLogsResp = client.GetLogs(getLogsReq); Assert.IsTrue(getLogsResp.Count == (PUT_COUNT / TOPIC_COUNT) * LOGITEM_COUNT); String logs = getLogsResp.Print(); for (int m = 0; m < CONTENT_COUNT; ++m) { String dstStr = "error_" + i + "_" + m; Assert.IsTrue(ChildStringOccurTimes(logs, dstStr) == getLogsResp.Count); } if ((k + 1) * (i + 1) % SLEEP_INTERVAL == 0) { Thread.Sleep(SLEEP_TIME); } } } Console.WriteLine(); }