예제 #1
0
        /// <summary>
        /// Returns of a list of traces that match the specified filter conditions.
        /// Documentation https://developers.google.com/cloudtrace/v1/reference/traces/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated CloudTrace service.</param>
        /// <param name="projectId">ID of the Cloud project where the trace data is stored.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ListTracesResponseResponse</returns>
        public static ListTracesResponse List(CloudTraceService service, string projectId, TracesListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }

                // Building the initial request.
                var request = service.Traces.List(projectId);

                // Applying optional parameters to the request.
                request = (TracesResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Traces.List failed.", ex);
            }
        }
예제 #2
0
        /// <summary>
        /// Gets a single trace by its ID.
        /// Documentation https://developers.google.com/cloudtrace/v1/reference/traces/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated CloudTrace service.</param>
        /// <param name="projectId">ID of the Cloud project where the trace data is stored.</param>
        /// <param name="traceId">ID of the trace to return.</param>
        /// <returns>TraceResponse</returns>
        public static Trace Get(CloudTraceService service, string projectId, string traceId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }
                if (traceId == null)
                {
                    throw new ArgumentNullException(traceId);
                }

                // Make the request.
                return(service.Traces.Get(projectId, traceId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Traces.Get failed.", ex);
            }
        }