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)
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)
def GetVPNServiceClass(): """Gets the VPNService class. Args: Returns: Implementation class """ return resource.GetResourceClass(VPNService)
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
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)
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)
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)
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)
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)
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)
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)
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)
def GetSpannerClass( service_type: str) -> Optional[resource.AutoRegisterResourceMeta]: """Return the Spanner class associated with service_type.""" return resource.GetResourceClass(GcpSpannerInstance, SERVICE_TYPE=service_type)
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)
def GetPlacementGroupClass(cloud): """Returns the PlacementGroup class corresponding to 'cloud'.""" return resource.GetResourceClass(BasePlacementGroup, CLOUD=cloud)
def GetAppServiceClass(service): return resource.GetResourceClass(BaseAppService, SERVICE=service)
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)
def GetDataDiscoveryServiceClass(cloud, service_type): """Gets the underlying Data Discovery Service class.""" return resource.GetResourceClass(BaseDataDiscoveryService, CLOUD=cloud, SERVICE_TYPE=service_type)