# Path: testbench/servers/iam_rest_server.py
# _IAM_HANDLER_PATH = "/iamapi"
# def sign_blob(service_account):
# def get_iam_app():
# 
# Path: testbench/servers/projects_rest_server.py
# _PROJECTS_HANDLER_PATH = "/storage/v1/projects"
# def get_projects_app(db):
#     def projects_get(project_id):
#     def hmac_keys_insert(project_id):
#     def hmac_keys_list(project_id):
#     def hmac_keys_delete(project_id, access_id):
#     def hmac_keys_get(project_id, access_id):
#     def hmac_keys_update(project_id, access_id):


import argparse
import datetime
import httpbin
import json
import logging
import flask
import gcs as gcs_type
import testbench
from google.protobuf import json_format
from werkzeug import serving
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from google.storage.v2 import storage_pb2
from testbench.servers import iam_rest_server, projects_rest_server
    bucket = db.get_bucket(bucket_name, None)
    acl = bucket.patch_acl(flask.request, entity, None)
    response = json_format.MessageToDict(acl)
    response["kind"] = "storage#bucketAccessControl"
    fields = flask.request.args.get("fields", None)
    return testbench.common.filter_response_rest(response, None, fields)


@gcs.route("/b/<bucket_name>/acl/<entity>", methods=["DELETE"])
@retry_test(method="storage.bucket_acl.delete")
def bucket_acl_delete(bucket_name, entity):
    bucket = db.get_bucket(bucket_name, None)
    bucket.delete_acl(entity, None)
    return ""


@gcs.route("/b/<bucket_name>/defaultObjectAcl")
@retry_test(method="storage.default_object_acl.list")
def bucket_default_object_acl_list(bucket_name):
    bucket = db.get_bucket(bucket_name, None)
    response = {"kind": "storage#objectAccessControls", "items": []}
    for acl in bucket.metadata.default_object_acl:
        acl_rest = json_format.MessageToDict(acl)
        acl_rest["kind"] = "storage#objectAccessControl"
        response["items"].append(acl_rest)
    fields = flask.request.args.get("fields", None)
    return testbench.common.filter_response_rest(response, None, fields)


@gcs.route("/b/<bucket_name>/defaultObjectAcl", methods=["POST"])

# Path: testbench/servers/iam_rest_server.py
# _IAM_HANDLER_PATH = "/iamapi"
# def sign_blob(service_account):
# def get_iam_app():
# 
# Path: testbench/servers/projects_rest_server.py
# _PROJECTS_HANDLER_PATH = "/storage/v1/projects"
# def get_projects_app(db):
#     def projects_get(project_id):
#     def hmac_keys_insert(project_id):
#     def hmac_keys_list(project_id):
#     def hmac_keys_delete(project_id, access_id):
#     def hmac_keys_get(project_id, access_id):
#     def hmac_keys_update(project_id, access_id):


# Path: testbench/rest_server.py
import argparse
import datetime
import httpbin
import json
import logging
import flask
import gcs as gcs_type
import testbench
from google.protobuf import json_format
from werkzeug import serving
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from google.storage.v2 import storage_pb2
from testbench.servers import iam_rest_server, projects_rest_server

    bucket = db.get_bucket(bucket_name, None)
    acl = bucket.patch_acl(flask.request, entity, None)
    response = json_format.MessageToDict(acl)
    response["kind"] = "storage#bucketAccessControl"
    fields = flask.request.args.get("fields", None)
    return testbench.common.filter_response_rest(response, None, fields)


@gcs.route("/b/<bucket_name>/acl/<entity>", methods=["DELETE"])
@retry_test(method="storage.bucket_acl.delete")
def bucket_acl_delete(bucket_name, entity):
    bucket = db.get_bucket(bucket_name, None)
    bucket.delete_acl(entity, None)
    return ""


@gcs.route("/b/<bucket_name>/defaultObjectAcl")
@retry_test(method="storage.default_object_acl.list")
def bucket_default_object_acl_list(bucket_name):
    bucket = db.get_bucket(bucket_name, None)
    response = {"kind": "storage#objectAccessControls", "items": []}
    for acl in bucket.metadata.default_object_acl:
        acl_rest = json_format.MessageToDict(acl)
        acl_rest["kind"] = "storage#objectAccessControl"
        response["items"].append(acl_rest)
    fields = flask.request.args.get("fields", None)
    return testbench.common.filter_response_rest(response, None, fields)


@gcs.route("/b/<bucket_name>/defaultObjectAcl", methods=["POST"])

@retry_test(method="storage.default_object_acl.insert")