General OCI Client?
まだ誰も着手していません。
評価
調査の方向性
まず、既存の ComputeClient インターフェースと AnalyticsClient インターフェース、および resource-search の結果でリソースの型と識別子がどのように公開されるかを確認します。共通操作の範囲と、呼び出し側がサービス固有のクライアントにアクセスする方法を定義します。提案された汎用クライアントが、リソースごとのラッパークラスを必要とせずに合意された操作をサポートできれば、作業は完了です。
索引モデルが 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
- スター
- 474
- フォーク
- 321
- 平均マージ
- 23分
- マージ済み PR(30日)
- 4
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
-
難易度 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
-
agent-ready documentation needs-triage
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
instance instance add
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
searxng/searx-instances#939 · コメント 1 件 ·
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100