private static async Task ListLogs(LoggingManagementClient client, string logGroup)
        {
            ListLogsRequest listLogsRequest = new ListLogsRequest
            {
                LogGroupId = logGroup
            };
            // Pass the log group whose logs you want to list
            ListLogsResponse response = await client.ListLogs(listLogsRequest);

            logger.Info("List Logs");
            logger.Info("=============");
            foreach (LogSummary logSummary in response.Items)
            {
                logger.Info($"Log Display Name: {logSummary.DisplayName}, Log Type:{logSummary.LogType}");
            }
        }
Example #2
0
 protected override void ProcessRecord()
 {
     ProjectsResource.LogsResource.ListRequest listRequest = Service.Projects.Logs.List($"projects/{Project}");
     do
     {
         try
         {
             ListLogsResponse response = listRequest.Execute();
             if (response.LogNames != null)
             {
                 WriteObject(response.LogNames, true);
             }
             listRequest.PageToken = response.NextPageToken;
         }
         catch (GoogleApiException ex) when(ex.HttpStatusCode == System.Net.HttpStatusCode.NotFound)
         {
             throw new PSArgumentException($"Project {Project} does not exist.");
         }
     }while (!Stopping && listRequest.PageToken != null);
 }
        public static ListLogsResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListLogsResponse listLogsResponse = new ListLogsResponse();

            listLogsResponse.HttpResponse = _ctx.HttpResponse;
            listLogsResponse.RequestId    = _ctx.StringValue("ListLogs.requestId");
            listLogsResponse.Code         = _ctx.StringValue("ListLogs.code");
            listLogsResponse.Message      = _ctx.StringValue("ListLogs.message");

            List <Dictionary <string, string> > listLogsResponse_result = new List <Dictionary <string, string> >();

            for (int i = 0; i < _ctx.Length("ListLogs.Result.Length"); i++)
            {
                Dictionary <string, string> tmp = new Dictionary <string, string>()
                {
                };
                foreach (var _item in _ctx.ResponseDictionary)
                {
                    string prefix = "ListLogs.Result[" + i + "].";
                    if (_item.Key.IndexOf(prefix) == 0)
                    {
                        tmp.Add(_item.Key.Substring(prefix.Length), _item.Value);
                    }
                }
                if (tmp.Count > 0)
                {
                    listLogsResponse_result.Add(tmp);
                }
            }
            listLogsResponse.Result = listLogsResponse_result;

            ListLogsResponse.ListLogs_Headers headers = new ListLogsResponse.ListLogs_Headers();
            headers.XTotalCount      = _ctx.IntegerValue("ListLogs.Headers.X-Total-Count");
            listLogsResponse.Headers = headers;

            return(listLogsResponse);
        }