How to use the fastly.models.Version function in fastly

To help you get started, we’ve selected a few fastly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fastly / fastly-py / fastly / fastly.py View on Github external
def versions(self, service_id):
        return Version.list(self.conn, service_id=service_id)
github fastly / fastly-py / fastly / fastly.py View on Github external
def version(self, service_id, version):
        return Version.find(self.conn, service_id=service_id, number=version)
github fastly / fastly-py / fastly / models.py View on Github external
def version(self):
        """ Create a new version under this service. """
        ver = Version()
        ver.conn = self.conn

        ver.attrs = {
            # Parent params
            'service_id': self.attrs['id'],
        }

        ver.save()

        return ver
github fastly / fastly-py / fastly / models.py View on Github external
INSTANCE_PATTERN = COLLECTION_PATTERN + '/$id'

class Settings(Model):
    INSTANCE_PATTERN = Version.COLLECTION_PATTERN + '/$version/settings'
    COLLECTION_PATTERN = INSTANCE_PATTERN

class Condition(Model):
    COLLECTION_PATTERN = Version.COLLECTION_PATTERN + '/$version/condition'
    INSTANCE_PATTERN = COLLECTION_PATTERN + '/$name'

class Header(Model):
    COLLECTION_PATTERN = Version.COLLECTION_PATTERN + '/$version/header'
    INSTANCE_PATTERN = COLLECTION_PATTERN + '/$name'

class VCL(Model):
    COLLECTION_PATTERN = Version.COLLECTION_PATTERN + '/$version/vcl'
    INSTANCE_PATTERN = COLLECTION_PATTERN + '/$name'

    def download(self):
        resp, data = self._query('GET', '/download')
        return data

    def main(self):
        resp, data = self._query('PUT', '/main')
        return data

class Dictionary(Model):
    COLLECTION_PATTERN = Version.COLLECTION_PATTERN + '/$version/dictionary'
    INSTANCE_PATTERN = COLLECTION_PATTERN + '/$name'

    def info(self):
        resp, data = self._collection_query('GET', suffix='/$id/info')