コード例 #1
0
ファイル: app.py プロジェクト: richdost/predixpy
    def create_manifest_from_space(self):
        """
        Populate a manifest file generated from details from the
        cloud foundry space environment.
        """
        space = predix.admin.cf.spaces.Space()

        summary = space.get_space_summary()
        for instance in summary['services']:
            service_type = instance['service_plan']['service']['label']
            name = instance['name']
            if service_type == 'predix-uaa':
                uaa = predix.admin.uaa.UserAccountAuthentication(name=name)
                uaa.add_to_manifest(self)
            elif service_type == 'predix-acs':
                acs = predix.admin.acs.AccessControl(name=name)
                acs.add_to_manifest(self)
            elif service_type == 'predix-asset':
                asset = predix.admin.asset.Asset(name=name)
                asset.add_to_manifest(self)
            elif service_type == 'predix-timeseries':
                timeseries = predix.admin.timeseries.TimeSeries(name=name)
                timeseries.add_to_manifest(self)
            elif service_type == 'predix-blobstore':
                blobstore = predix.admin.blobstore.BlobStore(name=name)
                blobstore.add_to_manifest(self)
            elif service_type == 'us-weather-forecast':
                weather = predix.admin.weather.WeatherForecast(name=name)
                weather.add_to_manifest(self)
            else:
                logging.warn("Unsupported service type: %s" % service_type)
コード例 #2
0
ファイル: app.py プロジェクト: richdost/predixpy
    def create_weather(self):
        """
        Creates an instance of the Asset Service.
        """
        weather = predix.admin.weather.WeatherForecast()
        weather.create()

        client_id = self.get_client_id()
        if client_id:
            weather.grant_client(client_id)

        weather.grant_client(client_id)
        weather.add_to_manifest(self)
        return weather
コード例 #3
0
    def create_manifest_from_space(self):
        """
        Populate a manifest file generated from details from the
        cloud foundry space environment.
        """
        space = predix.admin.cf.spaces.Space()

        summary = space.get_space_summary()
        for instance in summary['services']:
            service_type = instance['service_plan']['service']['label']
            name = instance['name']
            if service_type in self.supported:
                service = self.supported[service_type](name=name)
                service.add_to_manifest(self)
            elif service_type == 'us-weather-forecast':
                weather = predix.admin.weather.WeatherForecast(name=name)
                weather.add_to_manifest(self)
            else:
                logging.warning("Unsupported service type: %s" % service_type)