Exemplo n.º 1
0
def dropdownQuery():
    if request.method == 'GET':
        dropdown_json = {}
        # Regions
        oci_regions = OCIRegions()
        dropdown_json["regions"] = sorted(oci_regions.list(),
                                          key=lambda k: k['name'])
        # Services
        oci_services = OCIServices()
        dropdown_json["services"] = sorted(oci_services.list(),
                                           key=lambda k: k['name'])
        # Instance Shapes
        oci_shapes = OCIShapes()
        dropdown_json["shapes"] = sorted(oci_shapes.list(),
                                         key=lambda k: k['sort_key'])
        # Instance Images
        oci_images = OCIImages()
        dropdown_json["images"] = sorted(oci_images.list(),
                                         key=lambda k: k['sort_key'])
        # Database System Shapes
        db_system_shapes = OCIDatabaseSystemShapes()
        dropdown_json["db_system_shapes"] = sorted(db_system_shapes.list(),
                                                   key=lambda k: k['shape'])
        # Database Versions
        db_versions = OCIDatabaseVersions()
        dropdown_json["db_versions"] = sorted(db_versions.list(),
                                              key=lambda k: k['version'])
        # CPE Device Shapes
        cpe_device_shapes = OCICpeDeviceShapes()
        dropdown_json["cpe_device_shapes"] = sorted(
            cpe_device_shapes.list(),
            key=lambda k: k['cpe_device_info']['vendor'])
        # Fast Connect Provider Services
        fast_connect_provider_services = OCIFastConnectProviderServices()
        dropdown_json["fast_connect_provider_services"] = sorted(
            fast_connect_provider_services.list(),
            key=lambda k: k['provider_name'])
        # MySQL Shapes
        mysql_shapes = OCIMySQLShapes()
        dropdown_json["mysql_shapes"] = sorted(mysql_shapes.list(),
                                               key=lambda k: k['name'])
        # Database Versions
        mysql_versions = OCIMySQLVersions()
        dropdown_json["mysql_versions"] = sorted(
            mysql_versions.list(), key=lambda k: k['version_family'])
        # MySQL Configurations
        mysql_configurations = OCIMySQLConfigurations()
        dropdown_json["mysql_configurations"] = sorted(
            mysql_configurations.list(), key=lambda k: k['display_name'])
        # Instance Shapes
        oci_loadbalancer_shapes = OCILoadBalancerShapes()
        dropdown_json["loadbalancer_shapes"] = sorted(
            oci_loadbalancer_shapes.list(), key=lambda k: k['name'])
        # Kubernetes Versions
        k8_versions = OCIKubernetesVersions()
        dropdown_json["kubernetes_versions"] = sorted(
            k8_versions.list(), key=lambda k: k['version'], reverse=True)
        return dropdown_json
    else:
        return 'Unknown Method', 500
Exemplo n.º 2
0
def ociRegion():
    query_string = request.query_string
    parsed_query_string = urllib.parse.unquote(query_string.decode())
    query_json = json.loads(parsed_query_string)
    logJson(query_json)
    config_profile = query_json.get('config_profile', 'DEFAULT')
    logger.info('Using Profile : {0!s:s}'.format(config_profile))
    oci_regions = OCIRegions(profile=config_profile)
    regions = oci_regions.list()
    logger.debug(">>>>>>>>> Regions: {0!s:s}".format(regions))
    return json.dumps(regions, sort_keys=False, indent=2, separators=(',', ': '))
Exemplo n.º 3
0
def dropdownQuery():
    if request.method == 'GET':
        dropdown_json = {}
        # Regions
        oci_regions = OCIRegions()
        dropdown_json["regions"] = sorted(oci_regions.list(),
                                          key=lambda k: k['name'])
        # Services
        oci_services = OCIServices()
        dropdown_json["services"] = sorted(oci_services.list(),
                                           key=lambda k: k['name'])
        # Instance Shapes
        oci_shapes = OCIShapes()
        dropdown_json["shapes"] = sorted(oci_shapes.list(),
                                         key=lambda k: k['sort_key'])
        # Instance Images
        oci_images = OCIImages()
        dropdown_json["images"] = sorted(oci_images.list(),
                                         key=lambda k: k['sort_key'])
        # Database System Shapes
        db_system_shapes = OCIDatabaseSystemShapes()
        dropdown_json["db_system_shapes"] = sorted(db_system_shapes.list(),
                                                   key=lambda k: k['shape'])
        # Database Versions
        db_versions = OCIDatabaseVersions()
        dropdown_json["db_versions"] = sorted(db_versions.list(),
                                              key=lambda k: k['version'])
        # CPE Device Shapes
        # TODO: Upgrade OCI Python Module
        #cpe_device_shapes = OCICpeDeviceShapes()
        #dropdown_json["cpe_device_shapes"] = sorted(cpe_device_shapes.list(), key=lambda k: k['cpe_device_info']['vendor'])
        # Fast Connect Provider Services
        fast_connect_provider_services = OCIFastConnectProviderServices()
        dropdown_json["fast_connect_provider_services"] = sorted(
            fast_connect_provider_services.list(),
            key=lambda k: k['provider_name'])
        return dropdown_json
    else:
        return 'Unknown Method', 500