Ejemplo n.º 1
0
def delete_module_release(module_name, module_version):
    if module_name is None:
        print('--module_name required')
        raise click.Abort()
    if module_version is None:
        print('--module_version required')
        raise click.Abort()
    client = Client()
    response = client.delete('/rest/rest/modules' + module_name + '/' +
                             module_version + '/release')
    utils.pretty_print(response)
Ejemplo n.º 2
0
def get_module_workingcopy_templates(module_name, module_version):
    if module_name is None:
        print('--module_name required')
        raise click.Abort()
    if module_version is None:
        print('--module_version required')
        raise click.Abort()
    client = Client()
    response = client.get('/rest/modules/' + module_name + '/' +
                          module_version + '/workingcopy/templates/')
    utils.pretty_print(response)
Ejemplo n.º 3
0
def delete_application_cache(application_name, platform_name):
    if application_name is None:
        print('--application_name required')
        raise click.Abort()
    if platform_name is None:
        print('--platform_name required')
        raise click.Abort()
    client = Client()
    response = client.delete('/rest/cache/application/' + application_name +
                             '/' + platform_name)
    utils.pretty_print(response)
Ejemplo n.º 4
0
def delete_workingcopy_template_package_cache(template_name, template_version):
    if template_name is None:
        print('--template_name required')
        raise click.Abort()
    if template_version is None:
        print('--template_version required')
        raise click.Abort()
    client = Client()
    response = client.delete('/rest/cache/template/package/' + template_name +
                             '/' + template_version + '/workingcopy')
    utils.pretty_print(response)
Ejemplo n.º 5
0
def regenerate_template_package_cache(template_name, template_version):
    if template_name is None:
        print('--template_name required')
        raise click.Abort()
    if template_version is None:
        print('--template_version required')
        raise click.Abort()
    client = Client()
    response = client.post('/rest/template/package/' + template_name + '/' +
                           template_version + '/regenerate')
    utils.pretty_print(response)
Ejemplo n.º 6
0
def delete_workingcopy_module_cache(module_name, module_version):
    if module_name is None:
        print('--module_name required')
        raise click.Abort()
    if module_version is None:
        print('--module_version required')
        raise click.Abort()
    client = Client()
    response = client.delete('/rest/cache/module/' + module_name + '/' +
                             module_version + '/workingcopy')
    utils.pretty_print(response)
Ejemplo n.º 7
0
def regenerate_module_cache(module_name, module_version):
    if module_name is None:
        print('--module_name required')
        raise click.Abort()
    if module_version is None:
        print('--module_version required')
        raise click.Abort()
    client = Client()
    response = client.post('/rest/cache/module/' + module_name + '/' +
                           module_version + '/regenerate')
    utils.pretty_print(response)
Ejemplo n.º 8
0
def get_templates_packages_release(package_name, package_version):
    if package_name is None:
        print('--package_name required')
        raise click.Abort()
    if package_version is None:
        print('--package_version required')
        raise click.Abort()
    client = Client()
    response = client.get('/rest/templates/packages/' + package_name + '/' +
                          package_version + '/release/templates')
    utils.pretty_print(response)
Ejemplo n.º 9
0
def delete_template_package_workingcopy(package_name, package_version):
    if package_name is None:
        print('--package_name required')
        raise click.Abort()
    if package_version is None:
        print('--package_version required')
        raise click.Abort()
    client = Client()
    response = client.delete('/rest/templates/packages/' + package_name + '/' +
                             package_version + '/workingcopy')
    utils.pretty_print(response)
Ejemplo n.º 10
0
def get_application_platform(application_name, platform_name):
    if application_name is None:
        print('--application_name required')
        raise click.Abort()
    if platform_name is None:
        print('--platform_name required')
        raise click.Abort()
    client = Client()
    response = client.get('/rest/applications/' + application_name +
                          '/platforms/' + platform_name)
    utils.pretty_print(response)
Ejemplo n.º 11
0
def restore_application_platform_snapshots(application_name, platform_name):
    if application_name is None:
        print('--application_name required')
        raise click.Abort()
    if platform_name is None:
        print('--platform_name required')
        raise click.Abort()
    client = Client()
    response = client.post('/rest/applications/' + application_name +
                           '/platforms/' + platform_name + '/restore_snapshot')
    utils.pretty_print(response)
Ejemplo n.º 12
0
def perform_search_application_platforms(application_name, platform_name):
    params = {}
    if application_name is None:
        print('--application_name required')
        raise click.Abort()
    params['application_name'] = application_name
    if platform_name:
        params['platform_name'] = platform_name
    client = Client()
    response = client.post('/rest/applications/platforms/perform_search',
                           params=params)
    utils.pretty_print(response)
Ejemplo n.º 13
0
def get_properties_instance_model(application_name, platform_name):
    if application_name is None:
        print('--application_name required')
        raise click.Abort()
    if platform_name is None:
        print('--platform_name required')
        raise click.Abort()
    client = Client()
    response = client.get('/rest/applications/' + application_name +
                          '/platforms/' + platform_name +
                          '/properties/instance-model')
    utils.pretty_print(response)
Ejemplo n.º 14
0
def get_module_release_template(module_name, module_version, template_name):
    if module_name is None:
        print('--module_name required')
        raise click.Abort()
    if module_version is None:
        print('--module_version required')
        raise click.Abort()
    client = Client()
    response = client.get('/rest/modules/' + module_name + '/' +
                          module_version + '/release/templates' +
                          template_name)
    utils.pretty_print(response)
Ejemplo n.º 15
0
def create_module_release(module_name, module_version, release_version):
    params = {}
    if module_name is None:
        print('--module_name required')
        raise click.Abort()
    if module_version is None:
        print('--module_version required')
        raise click.Abort()
    params['module_name'] = module_name
    params['release_version'] = release_version
    client = Client()
    response = client.post('/rest/modules/create_release', params=params)
    utils.pretty_print(response)
Ejemplo n.º 16
0
def get_global_properties(application_name, platform_name, timestamp):
    params = {}
    params["path"] = "#"
    if timestamp:
        params["timestamp"] = "timestamp"
    response = Client().get(
        "/rest/applications/"
        + application_name
        + "/platforms/"
        + platform_name
        + "/properties",
        params=params,
    )
    utils.pretty_print(response)
Ejemplo n.º 17
0
def get_application_from_module(module, version, type):
    if module is None:
        print('--module required')
        raise click.Abort()
    if version is None:
        print('--version required')
        raise click.Abort()
    if type is None:
        print('--type required')
        raise click.Abort()
    client = Client()
    response = client.get('/rest/applications/using_module/' + module + '/' +
                          version + '/' + type)
    utils.pretty_print(response)
Ejemplo n.º 18
0
def create_techno(body, from_name, from_version, from_is_working_copy):
    params = {}
    if from_name is None and from_version:
        raise click.BadParameter(
            "--from-name required when --from-version is given")
    if from_name and from_version is None:
        raise click.BadParameter(
            "--from-version required when --from-name is given")
    params["from_name"] = from_name
    params["from_version"] = from_version
    params["from_is_working_copy"] = from_is_working_copy
    with open(body, "r") as body_file:
        file_body = body_file.read()
    response = Client().post("/rest/technos", params=params, body=file_body)
    utils.pretty_print(response)
Ejemplo n.º 19
0
def update_application_platform(
    body, application_name, copy_properties_for_upgraded_modules
):
    params = {}
    if copy_properties_for_upgraded_modules:
        params[
            "copy_properties_for_upgraded_modules"
        ] = copy_properties_for_upgraded_modules
    with open(body, "r") as body_file:
        file_body = body_file.read()
    response = Client().put(
        "/rest/applications/" + application_name + "/platforms",
        params=params,
        body=file_body,
    )
    utils.pretty_print(response)
Ejemplo n.º 20
0
def delete_module_workingcopy_template(module_name, module_version,
                                       template_name):
    if module_name is None:
        print('--module_name required')
        raise click.Abort()
    if module_version is None:
        print('--module_version required')
        raise click.Abort()
    if template_name is None:
        print('--template_name required')
        raise click.Abort()
    client = Client()
    response = client.delete('/rest/rest/modules' + module_name + '/' +
                             module_version + '/workingcopy/templates/' +
                             template_name)
    utils.pretty_print(response)
Ejemplo n.º 21
0
def get_global_properties(application_name, platform_name, timestamp):
    params = {}
    if application_name is None:
        print('--application_name required')
        raise click.Abort()
    if platform_name is None:
        print('--platform_name required')
        raise click.Abort()
    params['path'] = "#"
    if timestamp:
        params['timestamp'] = "timestamp"
    client = Client()
    response = client.get('/rest/applications/' + application_name +
                          '/platforms/' + platform_name + '/properties',
                          params=params)
    utils.pretty_print(response)
Ejemplo n.º 22
0
def get_properties(application_name, platform_name, path, timestamp, export):
    params = {}
    params["path"] = path
    if timestamp:
        params["timestamp"] = "timestamp"
    response = Client().get(
        "/rest/applications/"
        + application_name
        + "/platforms/"
        + platform_name
        + "/properties",
        params=params,
    )
    if export:
        _export(response.json()["key_value_properties"])
    else:
        utils.pretty_print(response)
Ejemplo n.º 23
0
def create_application_platform(
    body, application_name, from_application, from_platform
):
    if from_application is None and from_platform:
        raise click.BadParameter(
            "--from-application required when --from-platform is given"
        )
    if from_application and from_platform is None:
        raise click.BadParameter(
            "--from-platform required when --from-application is given"
        )
    with open(body, "r") as body_file:
        file_body = body_file.read()
    response = Client().post(
        "/rest/applications/" + application_name + "/platforms", body=file_body
    )
    utils.pretty_print(response)
Ejemplo n.º 24
0
def create_module_workingcopy_template(module_name, module_version, body):
    if module_name is None:
        print('--module_name required')
        raise click.Abort()
    if module_version is None:
        print('--module_version required')
        raise click.Abort()
    if body is None:
        print('--body required')
        raise click.Abort()
    file = open(body, "r")
    file_body = file.read()
    file.close()
    client = Client()
    response = client.post('/rest/rest/modules' + module_name + '/' +
                           module_version + '/workingcopy',
                           body=file_body)
    utils.pretty_print(response)
Ejemplo n.º 25
0
def take_application_platform_snapshot(application_name, platform_name, body):
    if application_name is None:
        print('--application_name required')
        raise click.Abort()
    if platform_name is None:
        print('--platform_name required')
        raise click.Abort()
    if body is None:
        print('--body required')
        raise click.Abort()
    file = open(body, "r")
    file_body = file.read()
    file.close()
    client = Client()
    response = client.post('/rest/applications/' + application_name +
                           '/platforms/' + platform_name + '/take_snapshot',
                           body=file_body)
    utils.pretty_print(response)
def upsert_module_workingcopy_template(
    template_desc_filepath, module_name, module_version
):
    with open(template_desc_filepath, "r") as template_desc_file:
        template_desc = json.load(template_desc_file)
    response = _get_module_workingcopy_template(
        module_name, module_version, template_desc["filename"]
    )
    if response.status_code == 200:
        template_desc["version_id"] = response.json()["version_id"]
        response = _update_module_workingcopy_template(
            json.dumps(template_desc), module_name, module_version
        )
    elif response.status_code == 404:
        template_desc["version_id"] = -1
        response = _create_module_workingcopy_template(
            json.dumps(template_desc), module_name, module_version
        )
    else:
        response.raise_for_status()
    utils.pretty_print(response)
Ejemplo n.º 27
0
def update_application_platform(application_name,
                                copy_properties_for_upgraded_modules, body):
    params = {}
    if application_name is None:
        print('--application_name required')
        raise click.Abort()
    if body is None:
        print('--body required')
        raise click.Abort()
    if copy_properties_for_upgraded_modules:
        params[
            'copy_properties_for_upgraded_modules'] = copy_properties_for_upgraded_modules
    file = open(body, "r")
    file_body = file.read()
    file.close()
    client = Client()
    response = client.put('/rest/applications/' + application_name +
                          '/platforms',
                          params=params,
                          body=file_body)
    utils.pretty_print(response)
Ejemplo n.º 28
0
def create_application_platform(application_name, from_application,
                                from_platform, body):
    if application_name is None:
        print('--application_name required')
        raise click.Abort()
    if from_application is None and from_platform:
        print('--from_application required when --from_platform is given')
        raise click.Abort()
    if from_application and from_platform is None:
        print('--from_platform required when --from_application is given')
        raise click.Abort()
    if body is None:
        print('--body required')
        raise click.Abort()
    file = open(body, "r")
    file_body = file.read()
    file.close()
    client = Client()
    response = client.post('/rest/applications/' + application_name +
                           '/platforms',
                           body=file_body)
    utils.pretty_print(response)
Ejemplo n.º 29
0
def create_template_package_workingcopy(package_name, package_version,
                                        template_name, body):
    if package_name is None:
        print('--package_name required')
        raise click.Abort()
    if package_version is None:
        print('--package_version required')
        raise click.Abort()
    if template_name is None:
        print('--template_name required')
        raise click.Abort()
    if body is None:
        print('--body required')
        raise click.Abort()
    file = open(body, "r")
    file_body = file.read()
    file.close()
    client = Client()
    response = client.post('/rest/templates/packages/' + package_name + '/' +
                           package_version + '/workingcopy/templates/' +
                           template_name,
                           body=file_body)
    utils.pretty_print(response)
def get_module(module_name, module_version, module_type):
    client = Client()
    if module_version is None and module_type is None:
        response = client.get("/rest/modules/" + module_name)
        utils.pretty_print(response)
    if module_version and module_type is None:
        response = client.get("/rest/modules/" + module_name + "/" + module_version)
        utils.pretty_print(response)
    if module_version and module_type:
        response = client.get(
            "/rest/modules/" + module_name + "/" + module_version + "/" + module_type
        )
        utils.pretty_print(response)