def get_api_class(self, api_client): resp = client.AppsApi(api_client).get_api_group() group_version = resp.preferred_version.group_version # NOTE: 针对1.8对应的preferred_version: apps/v1beta1调整为apps/v1beta2 # 因为针对1.8集群,返回的preferred_version有问题,找不到对应的resource if group_version == preferred_version: group_version = updated_preferred_version return self.compose_api_class(group_version)
def get_api_class(self, api_client): resp = client.AppsApi(api_client).get_api_group() group_version = resp.preferred_version.group_version return self.compose_api_class(group_version)
def api_versions(self): resp = client.AppsApi(self.api_client).get_api_group() return [ f"{''.join([i.capitalize() for i in ver.group_version.split('/')])}Api" for ver in resp.versions ]