Example #1
0
def plan_list(request, search_opts=None):
    search_opts = search_opts or {}

    paginate = search_opts.pop('paginate', False)
    marker = search_opts.pop('marker', None)
    sort_dir = search_opts.pop('sort_dir', 'desc')

    if paginate:
        page_size = utils.get_page_size(request)

        plans = api.conveyorclient(request).plans.list(
            search_opts,
            marker=marker,
            limit=page_size + 1,
            sort_key='created_at',
            sort_dir=sort_dir)
    else:
        plans = api.conveyorclient(request).plans.list(search_opts)

    plans = [models.Plan(p) for p in plans]

    if paginate:
        return update_pagination(plans, page_size, marker, sort_dir)
    else:
        return plans, None, None
Example #2
0
def clone(request, plan_id, destination, clone_resources,
          update_resources=None, replace_resources=None, clone_links=None,
          sys_clone=False, copy_data=True):
    if update_resources is None:
        update_resources = []
    if replace_resources is None:
        replace_resources = []
    if clone_links is None:
        clone_links = []
    return api.conveyorclient(request).clones.clone(
        plan_id, destination, clone_resources,
        update_resources=update_resources, clone_links=clone_links,
        replace_resources=replace_resources,
        sys_clone=sys_clone, copy_data=copy_data
    )
Example #3
0
def list_clone_resources_attribute(request, plan_id, attribute_name):
    return api.conveyorclient(request).resources\
        .list_clone_resources_attribute(plan_id, attribute_name)
Example #4
0
def create_plan_by_template(request, template):
    return api.conveyorclient(request).plans.create_plan_by_template(template)
Example #5
0
def download_template(request, plan_id):
    return api.conveyorclient(request).plans.download_template(plan_id)
Example #6
0
def plan_get(request, plan_id):
    return models.Plan(api.conveyorclient(request).plans.get(plan_id))
Example #7
0
def plan_delete(request, plan_id):
    return api.conveyorclient(request).plans.delete(plan_id)
Example #8
0
def plan_create(request, plan_type, resources,
                plan_name=None):
    return models.Plan(api.conveyorclient(request).plans.create(
        plan_type, resources, plan_name=plan_name))
Example #9
0
def migrate(request, plan_id, destination):
    return api.conveyorclient(request).migrates.migrate(plan_id, destination)
Example #10
0
def export_migrate_template(request, plan_id):
    return api.conveyorclient(request)\
        .migrates.export_migrate_template(plan_id)
Example #11
0
def resource_get(request, res_type, res_id):
    return api.conveyorclient(request).resources.get_resource_detail(res_type,
                                                                     res_id)
Example #12
0
def resource_list(request, resource_type, search_opts=None):
    if not search_opts:
        search_opts = {}
    search_opts['type'] = resource_type
    return api.conveyorclient(request).resources.list(search_opts)
Example #13
0
def build_resources_topo(request, plan_id, az_map, search_opt=None):
    return api.conveyorclient(request)\
        .resources.build_resources_topo(plan_id, az_map, search_opt=search_opt)