Esempio n. 1
0
File: v1_0.py Progetto: zhenz/blazar
from oslo_log import log as logging

from blazar.api.v1.leases import service
from blazar.api.v1 import utils as api_utils
from blazar.api.v1 import validation
from blazar import utils

LOG = logging.getLogger(__name__)


def get_rest():
    """Return Rest app"""
    return rest


rest = api_utils.Rest('v1_0', __name__, url_prefix='/v1')
_api = utils.LazyProxy(service.API)

# Leases operations


@rest.get('/leases', query=True)
def leases_list(req, query):
    """List all existing leases."""
    return api_utils.render(leases=_api.get_leases(query))


@rest.post('/leases')
def leases_create(req, data):
    """Create new lease."""
    return api_utils.render(lease=_api.create_lease(data))
Esempio n. 2
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from oslo_log import log as logging

from blazar.api.v1.leases import service
from blazar.api.v1 import utils as api_utils
from blazar.api.v1 import validation
from blazar import utils

LOG = logging.getLogger(__name__)

rest = api_utils.Rest('v1_0', __name__)
_api = utils.LazyProxy(service.API)

# Leases operations


@rest.get('/leases', query=True)
def leases_list(query):
    """List all existing leases."""
    return api_utils.render(leases=_api.get_leases(query))


@rest.post('/leases')
def leases_create(data):
    """Create new lease."""
    return api_utils.render(lease=_api.create_lease(data))
Esempio n. 3
0
File: v1_0.py Progetto: zhenz/blazar
# See the License for the specific language governing permissions and
# limitations under the License.

from blazar.api.v1.floatingips import service
from blazar.api.v1 import utils as api_utils
from blazar.api.v1 import validation
from blazar import utils


def get_rest():
    """Return Rest app"""
    return rest


rest = api_utils.Rest('floatingip_v1_0',
                      __name__,
                      url_prefix='/v1/floatingips')
_api = utils.LazyProxy(service.API)

# Floatingips operations


@rest.get('')
def floatingips_list(req):
    """List all existing floatingips."""
    return api_utils.render(floatingips=_api.get_floatingips())


@rest.post('')
def floatingips_create(req, data):
    """Create new floatingip."""
Esempio n. 4
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from blazar.api.v1.oshosts import service
from blazar.api.v1 import utils as api_utils
from blazar.api.v1 import validation
from blazar import utils

rest = api_utils.Rest('host_v1_0', __name__)
_api = utils.LazyProxy(service.API)

# Computehosts operations


@rest.get('')
def computehosts_list():
    """List all existing computehosts."""
    return api_utils.render(hosts=_api.get_computehosts())


@rest.post('')
def computehosts_create(data):
    """Create new computehost."""
    return api_utils.render(host=_api.create_computehost(data))
Esempio n. 5
0
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from blazar.api.v1.oshosts import service
from blazar.api.v1 import utils as api_utils
from blazar.api.v1 import validation
from blazar import utils


def get_rest():
    """Return Rest app"""
    return rest


rest = api_utils.Rest('host_v1_0', __name__, url_prefix='/v1/os-hosts')
_api = utils.LazyProxy(service.API)

# Computehosts operations


@rest.get('', query=True)
def computehosts_list(query=None):
    """List all existing computehosts."""
    return api_utils.render(hosts=_api.get_computehosts(query))


@rest.post('')
def computehosts_create(data):
    """Create new computehost."""
    return api_utils.render(host=_api.create_computehost(data))