示例#1
0
        // [END monitoring_list_resources]

        // [START monitoring_get_resource]
        public static object GetMonitoredResource(string projectId, string resourceId)
        {
            MetricServiceClient             client = MetricServiceClient.Create();
            MonitoredResourceDescriptorName name   = new MonitoredResourceDescriptorName(projectId, resourceId);
            var    response = client.GetMonitoredResourceDescriptor(name);
            string resource = JObject.Parse($"{response}").ToString();

            Console.WriteLine($"{ resource }");
            return(0);
        }
示例#2
0
 /// <summary>Snippet for GetMonitoredResourceDescriptor</summary>
 public void GetMonitoredResourceDescriptor()
 {
     // Snippet: GetMonitoredResourceDescriptor(MonitoredResourceDescriptorName,CallSettings)
     // Create client
     MetricServiceClient metricServiceClient = MetricServiceClient.Create();
     // Initialize request argument(s)
     MonitoredResourceDescriptorName name = new MonitoredResourceDescriptorName("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
     // Make the request
     MonitoredResourceDescriptor response = metricServiceClient.GetMonitoredResourceDescriptor(name);
     // End snippet
 }