def GetManagedRelationalDbClass(cloud):
  """Get the ManagedRelationalDb class corresponding to 'cloud'.

  Args:
    cloud: name of cloud to get the class for
  """
  return resource.GetResourceClass(BaseManagedRelationalDb, CLOUD=cloud)
Ejemplo n.º 2
0
def GetStaticVmClass(os_type):
    """Returns the static VM class that corresponds to the os_type."""
    if not os_type:
        logging.warning('Could not find os type for VM. Defaulting to debian.')
        os_type = os_types.DEBIAN
    return resource.GetResourceClass(virtual_machine.BaseVirtualMachine,
                                     CLOUD=StaticVirtualMachine.CLOUD,
                                     OS_TYPE=os_type)
Ejemplo n.º 3
0
def GetVPNServiceClass():
    """Gets the VPNService class.

  Args:

  Returns:
    Implementation class
  """
    return resource.GetResourceClass(VPNService)
Ejemplo n.º 4
0
def GetRelationalDbClass(cloud, is_managed_db, engine):
  """Get the RelationalDb class corresponding to 'cloud'.

  Args:
    cloud: name of cloud to get the class for
    is_managed_db: is the database self managed or database a a service
    engine: database engine type

  Returns:
    BaseRelationalDb class with the cloud attribute of 'cloud'.
  """
  relational_db = None
  try:
    relational_db = resource.GetResourceClass(
        BaseRelationalDb, CLOUD=cloud, IS_MANAGED=is_managed_db, ENGINE=engine)
  except errors.Resource.SubclassNotFoundError:
    relational_db = resource.GetResourceClass(BaseRelationalDb, CLOUD=cloud)
  return relational_db
Ejemplo n.º 5
0
def GetResourceClass(cloud):
    """Get the CapacityReservation class corresponding to 'cloud'.

  Args:
    cloud: name of cloud to get the class for.

  Returns:
    Cloud-specific implementation of BaseCapacityReservation.
  """
    return resource.GetResourceClass(BaseCapacityReservation, CLOUD=cloud)
Ejemplo n.º 6
0
def GetRelationalDbClass(cloud):
  """Get the RelationalDb class corresponding to 'cloud'.

  Args:
    cloud: name of cloud to get the class for

  Returns:
    BaseRelationalDb class with the cloud attribute of 'cloud'.
  """
  return resource.GetResourceClass(BaseRelationalDb, CLOUD=cloud)
Ejemplo n.º 7
0
def GetNfsServiceClass(cloud):
    """Get the NFS service corresponding to the cloud.

  Args:
    cloud: The name of the cloud to supply the NFS service.

  Returns:
    The NFS service class for this cloud.

  Raises:
    NotImplementedError: No service found for this cloud.
  """
    return resource.GetResourceClass(BaseNfsService, CLOUD=cloud)
Ejemplo n.º 8
0
def GetCloudTpuClass(cloud):
    """Gets the cloud TPU class corresponding to 'cloud'.

  Args:
    cloud: String. name of cloud to get the class for.

  Returns:
    Implementation class corresponding to the argument cloud

  Raises:
    Exception: An invalid cloud TPU was provided
  """
    return resource.GetResourceClass(BaseCloudTpu, CLOUD=cloud)
Ejemplo n.º 9
0
def GetDpbServiceClass(dpb_service_type):
  """Gets the Data Processing Backend class corresponding to 'service_type'.

  Args:
    dpb_service_type: String service type as specified in configuration

  Returns:
    Implementation class corresponding to the argument dpb_service_type

  Raises:
    Exception: An invalid data processing backend service type was provided
  """
  return resource.GetResourceClass(
      BaseDpbService, SERVICE_TYPE=dpb_service_type)
def GetManagedMemoryStoreClass(cloud, memory_store):
    """Gets the cloud managed memory store class corresponding to 'cloud'.

  Args:
    cloud: String. Name of cloud to get the class for.
    memory_store: String. Type of memory store to get the class for.

  Returns:
    Implementation class corresponding to the argument cloud

  Raises:
    Exception: An invalid cloud was provided
  """
    return resource.GetResourceClass(BaseManagedMemoryStore,
                                     CLOUD=cloud,
                                     MEMORY_STORE=memory_store)
Ejemplo n.º 11
0
def GetDpbServiceClass(
        cloud: str, dpb_service_type: str) -> Optional[Type[BaseDpbService]]:
    """Gets the Data Processing Backend class corresponding to 'service_type'.

  Args:
    cloud: String name of cloud of the service
    dpb_service_type: String service type as specified in configuration

  Returns:
    Implementation class corresponding to the argument dpb_service_type

  Raises:
    Exception: An invalid data processing backend service type was provided
  """
    if dpb_service_type in UNMANAGED_SERVICES:
        cloud = 'Unmanaged'
    return resource.GetResourceClass(BaseDpbService,
                                     CLOUD=cloud,
                                     SERVICE_TYPE=dpb_service_type)
def GetMessagingServiceClass(cloud, delivery):
    """Gets the underlying Messaging Service class."""
    return resource.GetResourceClass(BaseMessagingService,
                                     CLOUD=cloud,
                                     DELIVERY=delivery)
def GetContainerClusterClass(cloud, cluster_type):
    return resource.GetResourceClass(BaseContainerCluster,
                                     CLOUD=cloud,
                                     CLUSTER_TYPE=cluster_type)
def GetContainerRegistryClass(cloud):
    return resource.GetResourceClass(BaseContainerRegistry, CLOUD=cloud)
Ejemplo n.º 15
0
def GetContainerClusterClass(cloud):
    return resource.GetResourceClass(BaseContainerCluster, CLOUD=cloud)
def GetAwsVpcEndpointClass(aws_service):
  """Returns the AwsVpcEndpoint class for the given service."""
  return resource.GetResourceClass(
      AwsVpcEndpoint, CLOUD=aws.CLOUD, AWS_SERVICE=aws_service)
def GetKubernetesDiskClass(volume_type):
  return resource.GetResourceClass(KubernetesDisk, K8S_VOLUME_TYPE=volume_type)
Ejemplo n.º 18
0
def GetSparkServiceClass(cloud, service_type):
    """Get the Spark class corresponding to 'cloud'."""
    if service_type == PKB_MANAGED:
        return PkbSparkService
    return resource.GetResourceClass(BaseSparkService, CLOUD=cloud)
Ejemplo n.º 19
0
def GetSpannerClass(
        service_type: str) -> Optional[resource.AutoRegisterResourceMeta]:
    """Return the Spanner class associated with service_type."""
    return resource.GetResourceClass(GcpSpannerInstance,
                                     SERVICE_TYPE=service_type)
Ejemplo n.º 20
0
def GetNonRelationalDbClass(
    service_type: str) -> Optional[resource.AutoRegisterResourceMeta]:
  """Gets the non-relational database class corresponding to 'service_type'."""
  return resource.GetResourceClass(BaseNonRelationalDb,
                                   SERVICE_TYPE=service_type)
Ejemplo n.º 21
0
def GetPlacementGroupClass(cloud):
    """Returns the PlacementGroup class corresponding to 'cloud'."""
    return resource.GetResourceClass(BasePlacementGroup, CLOUD=cloud)
Ejemplo n.º 22
0
def GetAppServiceClass(service):
    return resource.GetResourceClass(BaseAppService, SERVICE=service)
Ejemplo n.º 23
0
def GetVmClass(cloud, os_type):
    """Returns the VM class corresponding to 'cloud' and 'os_type'."""
    return resource.GetResourceClass(BaseVirtualMachine,
                                     CLOUD=cloud,
                                     OS_TYPE=os_type)
Ejemplo n.º 24
0
def GetDataDiscoveryServiceClass(cloud, service_type):
    """Gets the underlying Data Discovery Service class."""
    return resource.GetResourceClass(BaseDataDiscoveryService,
                                     CLOUD=cloud,
                                     SERVICE_TYPE=service_type)