Ejemplo n.º 1
0
  def GET(self): # pylint: disable=R0201
    """
      Returns list of supported Clouwdwatch regions

      ::

          GET /_metrics/cloudwatch/regions

      Returns:

      ::

          { 'region-name': 'region-description',...}

      Sample output:

      ::

          {
            "ap-northeast-1": "Asia Pacific (Tokyo) Region",
            "ap-southeast-1": "Asia Pacific (Singapore) Region",
            "ap-southeast-2": "Asia Pacific (Sydney) Region",
            "eu-west-1": "EU (Ireland) Region",
            "sa-east-1": "South America (Sao Paulo) Region",
            "us-east-1": "US East (Northern Virginia) Region",
            "us-west-1": "US West (Northern California) Region",
            "us-west-2": "US West (Oregon) Region"
          }
    """
    adapter = datasource_adapter_factory.createCloudwatchDatasourceAdapter()
    AuthenticatedBaseHandler.addStandardHeaders()
    return utils.jsonEncode(dict(adapter.describeRegions()))
Ejemplo n.º 2
0
  def GET(self, section=None):
    """
    List All Settings

    ::

        GET /_settings

    Returns:

    ::

        {
          "section": {
              "option": "value", ...
          }, ...
        }

    OR

    List Some Settings

    ::

        GET /_settings/section

    ::

        {
          "option": "value", ...
        }
    """
    res = {}
    if section is None:
      res = self.getAllSettings()
    else:
      res = self.getSectionSettings(section)

    AuthenticatedBaseHandler.addStandardHeaders()
    return utils.jsonEncode(res)