# Path: libcloudforensics/providers/gcp/internal/common.py
# RETRY_MAX = 10
# COMPUTE_RFC1035_REGEX = re.compile('^(?=.{1,63}$)[a-z]([-a-z0-9]*[a-z0-9])?$')
# REGEX_DISK_NAME = COMPUTE_RFC1035_REGEX
# COMPUTE_NAME_LIMIT = 63
# STORAGE_LINK_URL = 'https://storage.cloud.google.com'
# DEFAULT_COMPUTE_INSTANCE_SCOPE = [
#     'https://www.googleapis.com/auth/devstorage.read_only',
#     'https://www.googleapis.com/auth/logging.write',
#     'https://www.googleapis.com/auth/monitoring.write',
#     'https://www.googleapis.com/auth/service.management.readonly',
#     'https://www.googleapis.com/auth/servicecontrol',
#     'https://www.googleapis.com/auth/trace.append'
# ]
# DEFAULT_SA_EMAIL = 'default'
#   COMPUTE_ENGINE_API_VERSION = 'v1'
# def GenerateDiskName(
#     snapshot: 'compute.GoogleComputeSnapshot',
#     disk_name_prefix: Optional[str] = None) -> str:
# def GenerateSourceRange(
#     exempted_src_ips: Optional[List[str]] = None) -> List[str]:
# def GenerateUniqueInstanceName(
#     prefix: str, truncate_at: Optional[int] = None) -> str:
# def CreateService(
#     service_name: str,
#     api_version: str) -> 'googleapiclient.discovery.Resource':
#   def __init__(self, project_id: Optional[str] = None) -> None:
#   def GceApi(self) -> 'googleapiclient.discovery.Resource':
#   def BlockOperation(
#       self, response: Dict[str, Any],
#       zone: Optional[str] = None) -> Dict[str, Any]:
# def ExecuteRequest(
#     client: 'googleapiclient.discovery.Resource',
#     func: str,
#     kwargs: Dict[str, Any],
#     throttle: bool = False) -> List[Dict[str, Any]]:
# def FormatRFC3339(datetime_instance: datetime.datetime) -> str:
# class GoogleCloudComputeClient:


import time
  import googleapiclient
from typing import TYPE_CHECKING, Dict, List, Any
from libcloudforensics.providers.gcp.internal import common
    services_client = self.GsuApi().services() # pylint: disable=no-member
    parent = 'projects/' + self.project_id
    request = {'parent': parent, 'filter': 'state:ENABLED'}
    responses = common.ExecuteRequest(services_client, 'list', request)

    services = []
    for response in responses:
      for service in response.get('services', []):
        services.append(service['config']['name'])

    return services

  def _BlockOperation(self, response: Dict[str, Any]) -> Dict[str, Any]:
    """Block until API operation is finished.

    Args:
      response (Dict): Service Usage API response.

    Returns:
      Dict: Holding the response of a get operation on an API object of type
          Operation.
    """

    operations_api = self.GsuApi().operations() # pylint: disable=no-member

    if response['name'] == self.NOOP_API_RESPONSE:
      return response

    while True:
      request = {'name': response['name']}

# Path: libcloudforensics/providers/gcp/internal/common.py
# RETRY_MAX = 10
# COMPUTE_RFC1035_REGEX = re.compile('^(?=.{1,63}$)[a-z]([-a-z0-9]*[a-z0-9])?$')
# REGEX_DISK_NAME = COMPUTE_RFC1035_REGEX
# COMPUTE_NAME_LIMIT = 63
# STORAGE_LINK_URL = 'https://storage.cloud.google.com'
# DEFAULT_COMPUTE_INSTANCE_SCOPE = [
#     'https://www.googleapis.com/auth/devstorage.read_only',
#     'https://www.googleapis.com/auth/logging.write',
#     'https://www.googleapis.com/auth/monitoring.write',
#     'https://www.googleapis.com/auth/service.management.readonly',
#     'https://www.googleapis.com/auth/servicecontrol',
#     'https://www.googleapis.com/auth/trace.append'
# ]
# DEFAULT_SA_EMAIL = 'default'
#   COMPUTE_ENGINE_API_VERSION = 'v1'
# def GenerateDiskName(
#     snapshot: 'compute.GoogleComputeSnapshot',
#     disk_name_prefix: Optional[str] = None) -> str:
# def GenerateSourceRange(
#     exempted_src_ips: Optional[List[str]] = None) -> List[str]:
# def GenerateUniqueInstanceName(
#     prefix: str, truncate_at: Optional[int] = None) -> str:
# def CreateService(
#     service_name: str,
#     api_version: str) -> 'googleapiclient.discovery.Resource':
#   def __init__(self, project_id: Optional[str] = None) -> None:
#   def GceApi(self) -> 'googleapiclient.discovery.Resource':
#   def BlockOperation(
#       self, response: Dict[str, Any],
#       zone: Optional[str] = None) -> Dict[str, Any]:
# def ExecuteRequest(
#     client: 'googleapiclient.discovery.Resource',
#     func: str,
#     kwargs: Dict[str, Any],
#     throttle: bool = False) -> List[Dict[str, Any]]:
# def FormatRFC3339(datetime_instance: datetime.datetime) -> str:
# class GoogleCloudComputeClient:


# Path: libcloudforensics/providers/gcp/internal/serviceusage.py
import time
  import googleapiclient
from typing import TYPE_CHECKING, Dict, List, Any
from libcloudforensics.providers.gcp.internal import common

    services_client = self.GsuApi().services() # pylint: disable=no-member
    parent = 'projects/' + self.project_id
    request = {'parent': parent, 'filter': 'state:ENABLED'}
    responses = common.ExecuteRequest(services_client, 'list', request)

    services = []
    for response in responses:
      for service in response.get('services', []):
        services.append(service['config']['name'])

    return services

  def _BlockOperation(self, response: Dict[str, Any]) -> Dict[str, Any]:
    """Block until API operation is finished.

    Args:
      response (Dict): Service Usage API response.

    Returns:
      Dict: Holding the response of a get operation on an API object of type
          Operation.
    """

    operations_api = self.GsuApi().operations() # pylint: disable=no-member

    if response['name'] == self.NOOP_API_RESPONSE:
      return response

    while True:
      request = {'name': response['name']}

      result = common.ExecuteRequest(operations_api, 'get', request)[0]