NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

graphs.py (1206B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\datadog\api\graphs.py
      2 from datadog.util.compat import urlparse
      3 from datadog.api.resources import CreateableAPIResource, ActionAPIResource, GetableAPIResource, ListableAPIResource
      4 
      5 class Graph(CreateableAPIResource, ActionAPIResource):
      6     _class_url = '/graph/snapshot'
      7 
      8     @classmethod
      9     def create(cls, **params):
     10         return super(Graph, cls).create(method='GET', **params)
     11 
     12     @classmethod
     13     def status(cls, snapshot_url):
     14         snap_path = urlparse(snapshot_url).path
     15         snap_path = snap_path.split('/snapshot/view/')[1].split('.png')[0]
     16         snapshot_status_url = '/graph/snapshot_status/{0}'.format(snap_path)
     17         return super(Graph, cls)._trigger_action('GET', snapshot_status_url)
     18 
     19 
     20 class Embed(ListableAPIResource, GetableAPIResource, ActionAPIResource, CreateableAPIResource):
     21     _class_url = '/graph/embed'
     22 
     23     @classmethod
     24     def enable(cls, embed_id):
     25         return super(Embed, cls)._trigger_class_action('GET', id=embed_id, name='enable')
     26 
     27     @classmethod
     28     def revoke(cls, embed_id):
     29         return super(Embed, cls)._trigger_class_action('GET', id=embed_id, name='revoke')