def delete_bk():
    """
        http://127.0.0.1:8080/delete_bk?bucket_name=comp4312_10000
    """
    try:
        bucket_name = "comp4312_a2_0670448"
        delete_bucket(bucket_name=bucket_name, force=True)
        return "Bucket {} deleted".format(bucket_name)
    except:
        return "Invalid bucket name"
def delete_bk():
    """
    http://127.0.0.1:8080/delete_bk?bucket_name=comp4312_10000
    """
    try:
        bucket_name = request.args.get("bucket_name", default="comp4312_1000", type=str)
        delete_bucket(bucket_name, force=False)

        return "Bucket {} deleted".format(bucket_name)
    except:
        return "Invalid bucket name"
Example #3
0
def delete_bk():
    """
        http://127.0.0.1:8080/delete_bk?bucket_name=comp4312_0870121-2
    """
    try:
        bucket_name = ""
        bucket_name = request.args.get('bucket_name', default='comp4312_0870121-2', type=str)
        delete_bucket(bucket_name)
        # Hint: obtain bucket_name then call a function to delete a bucket named bucket_name

    except:
        return "Invalid bucket name"
Example #4
0
def delete_bk():
    """
        http://127.0.0.1:8080/delete_bk?bucket_name=comp4312_10000
    """
    try:
        bucket_name = ""
        #####################
        bucket_name = "comp4312_assignment2_1092015"
        delete_bucket(bucket_name=bucket_name, force=False)
        ####################
        # Hint: obtain bucket_name then call a function to delete a bucket named bucket_name
    except:
        return "Invalid bucket name"
def delete_bk():
    """
        http://127.0.0.1:8080/delete_bk?bucket_name=assignment02
    """
    try:
        bucket_name = ""
        storage_client = storage.Client()
        bucket = storage_client.get_bucket(bucket_name)
        bucket_name = bucket.name
        delete_bucket(bucket_name)
        # Hint: obtain bucket_name then call a function to delete a bucket named bucket_name

    except:
        return "Invalid bucket name"
def delete_bk():
    """
        http://127.0.0.1:8080/delete_bk?bucket_name=comp4312_0892995dt
    """
    try:
        bucket_name = ""
        #####################
        # Your code is here #
        ####################
        # Hint: obtain bucket_name then call a function to delete a bucket named bucket_name
        bucket_name = request.args.get('bucket_name',
                                       default='comp4312_0892995dt',
                                       type=str)
        delete_bucket(bucket_name)
        return "Bucket {} deleted".format(bucket_name)
    except:
        return "Invalid bucket name"
Example #7
0
def delete_bk():
    """
        http://127.0.0.1:8080/delete_bk?bucket_name=comp4312_0864683
    """
    try:
        bucket_name = ""
        #####################
        # Your code is here #
        ####################
        # Hint: obtain bucket_name then call a function to delete a bucket named bucket_name
        bucket_name = request.args.get('bucket_name',
                                       default='comp4312_0864683',
                                       type=str)
        delete_bucket(bucket_name=bucket_name, force=True)
        return "Bucket deleted successfully"
    except:
        return "Invalid bucket name"
Example #8
0
def delete_bk():
    """
        http://127.0.0.1:8080/delete_bk?bucket_name=comp4312_10000demo
    """
    try:
        bucket_name = ""
        #####################
        # Your code is here #
        ####################
        # Hint: obtain bucket_name then call a function to delete a bucket named bucket_name
        bucket_name = request.args.get('bucket_name',
                                       default='comp4312_10000demo',
                                       type=str)
        from storage_delete_bucket import delete_bucket
        delete_bucket(bucket_name=bucket_name, force=True)
        return "Bucket {} deleted".format(bucket_name)
    except:
        return "Invalid bucket name"
def delete_bk():
    """
        http://127.0.0.1:8080/delete_bk?bucket_name=comp4312_assign2_0880562
    """
    try:
        bucket_name = ""
        #####################
        # Your code is here #
        ####################
        # Hint: obtain bucket_name then call a function to delete a bucket named bucket_name
        
        #gets the bucket name
        bucket_name = request.args.get('bucket_name', default='comp4312_assign2_0880562', type=str)
        
        #deletes the bucket using delete_bucket from storage_delete_bucket
        delete_bucket(bucket_name=bucket_name, force=True)
        return "Bucket deleted successfully"

    except:
        return "Invalid bucket name"
def delete_bk():
    """
        http://127.0.0.1:8080/delete_bk?bucket_name=comp4312_asmt2_0869016
    """
    try:
        bucket_name = ""
        bucket_name = request.args.get('bucket_name',
                                       default='comp4312_asmt2_0869016',
                                       type=str)
        #####################
        # Your code is here #
        ####my code #####
        #bucket_name = "comp4312_asmt2_0869016"#
        delete_bucket(bucket_name=bucket_name, force=True)
        #return " "
        #####my code#####
        ####################
        # Hint: obtain bucket_name then call a function to delete a bucket named bucket_name

    except:
        return "Invalid bucket name"
    source_blob_names = return_blobs(bucket_name)

    # An example of returned values in source_blob_names
    # source_blob_names = ['dandelion1.jpg', 'dandelion2.jpg', 'dandelion3.jpg',
    #                      'grass1.jpeg', 'grass2.jpeg', 'grass3.jpeg']

    # 2. Create paths to save all files in source_blob_names and store in destination_file_names
    import os
    download_path = "images/download/"
    destination_file_names = []
    # Your code is here
    destination_file_names = [
        os.path.join(download_path, path) for path in source_blob_names
    ]

    # An example of returned values in destination_file_names
    # destination_file_names = ['images/download/dandelion1.jpg', 'images/download/dandelion2.jpg',
    #                           'images/download/dandelion3.jpg', 'images/download/grass1.jpeg',
    #                           'images/download/grass2.jpeg', 'images/download/grass3.jpeg']

    # 3. Download files on the bucket_name bucket with names listed in source_blob_names
    #    and save to paths in destination_file_names
    download_blobs(bucket_name=bucket_name,
                   source_blob_names=source_blob_names,
                   destination_file_names=destination_file_names)

    # 4. Delete the bucket "comp4312_studentID" on gcp
    from storage_delete_bucket import delete_bucket
    # Your code is here
    delete_bucket(bucket_name=bucket_name, force=True)
    source_blob_names = return_blobs(bucket_name)

    # An example of returned values in source_blob_names
    # source_blob_names = ['dandelion1.jpg', 'dandelion2.jpg', 'dandelion3.jpg',
    #                      'grass1.jpeg', 'grass2.jpeg', 'grass3.jpeg']

    # 2. Create paths to save all files in source_blob_names and store in destination_file_names
    import os
    download_path = "images/download/"
    destination_file_names = []

    for file in source_blob_names:
        destination_file_names.append(download_path + file)

    # An example of returned values in destination_file_names
    # destination_file_names = ['images/download/dandelion1.jpg', 'images/download/dandelion2.jpg',
    #                           'images/download/dandelion3.jpg', 'images/download/grass1.jpeg',
    #                           'images/download/grass2.jpeg', 'images/download/grass3.jpeg']

    # 3. Download files on the bucket_name bucket with names listed in source_blob_names
    #    and save to paths in destination_file_names
    download_blobs(bucket_name=bucket_name,
                   source_blob_names=source_blob_names,
                   destination_file_names=destination_file_names)

    # 4. Delete the bucket "comp4312_studentid" on gcp
    from storage_delete_bucket import delete_bucket

    delete_bucket(bucket_name, True)