General OCI Client?
还没有人认领这个 Issue。
评估
调研方向
首先检查现有的 ComputeClient 和 AnalyticsClient 接口,以及资源搜索结果如何公开资源类型和标识符。定义通用操作的范围,以及调用方将如何访问特定于服务的客户端;当提议的通用客户端无需按资源使用包装类即可支持约定的操作时,这项工作就完成了。
由索引模型根据 Issue 内容生成。
描述
If you guys don't already have it, it would be awesome if there was a general OCI Client with at least the common methods in it, and maybe a way to expose the specific client.
I have a function app that runs on a schedule turning resources on and off based on tags. I created a class like this:
import oci
#Main Class
class OCIInstance:
def __init__(self, resource, oci_client):
self.resource = resource
self.oci_client = oci_client
def start(self):
raise NotImplementedError("Start not implemented for base class.")
def stop(self):
raise NotImplementedError("Stop not implemented for base class.")
#Implementations of it
class ComputeInstance(OCIInstance):
def start(self):
self.oci_client.instance_action(self.resource.identifier, 'START')
def stop(self):
self.oci_client.instance_action(self.resource.identifier, 'SOFTSTOP')
class AnalyticsInstance(OCIInstance):
def start(self):
self.oci_client.start_analytics_instance(self.resource.identifier)
def stop(self):
self.oci_client.stop_analytics_instance(self.resource.identifier)
#Factory for it
def instanceFactory(resource, signer):
resource_type = resource.resource_type
if resource_type == "Instance":
oci_client = oci.core.ComputeClient(config={}, signer=signer)
return ComputeInstance(resource, oci_client)
elif resource_type == "AnalyticsInstance":
oci_client = oci.analytics.AnalyticsClient(config={}, signer=signer)
return AnalyticsInstance(resource, oci_client)
# Add more types as needed
I then run a query like this query all resources where (definedTags.namespace = 'Schedule') and loop through the results adding them to a List of OCIInstance. I can then start and stop them from that list with a simple call to .start() or .stop().
This feels like a lot to do... it'd be way nicer if I could just call the client from the search results or if I could use a generic client for basic operations.
- 主要语言
- Python
- 星标
- 473
- 派生
- 322
- 平均合并
- 13 分钟
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
oracle/oci-python-sdk 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
oracle/oci-python-sdk#890 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
oracle/oci-python-sdk#879 · 3 条评论 ·
-
Example uses non-existent API可能已有人在做 @reginaldalfret 于 7 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 66/100
oracle/oci-python-sdk#878 ·
-
SDK
难度 3/5 1-2 天 新手友好度 55/100
oracle/oci-python-sdk#861 · 5 条评论 ·
-
SDK
难度 2/5 1-3 小时 新手友好度 48/100
oracle/oci-python-sdk#852 ·
查看 oracle/oci-python-sdk 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 78/100
uniswap-python/uniswap-python#487 ·
-
[Bug]: agent_final_response still returns the abandoned branch's answer after navigate moves HEAD back可能已有人在做 @enyst 今天认领。 未关闭bug priority:low ready-for-dev
难度 2/5 1-3 小时 新手友好度 72/100
OpenHands/software-agent-sdk#5822 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
-
area: server enhancement good first issue
难度 2/5 1-3 小时 新手友好度 82/100
scs0209/laya-guard#52 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复