Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

How can we retrieve the cost of child tenancies using the OCI Python SDK and the Usage API?

オープン
#763 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
20/100
issue の種類
ドキュメント
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
api, cloud

調査の方向性

この issue には、oci.usage_api.UsageapiClient と request_summarized_usages を使用する Python の例が含まれていますが、リポジトリのファイルもテストも指定されていません。まず、例に示されている Usage API リクエストと tenancy パラメータを確認してください。完了とするには、親 tenancy から子 tenancy のコストを取得する方法について、明確で検証済みの説明またはドキュメントが必要です。

索引モデルが issue の本文から書いたものです。

説明

How can we retrieve the costs of child tenancies using the OCI Python SDK and the Usage API.
Suppose I have four child tenancies, each associated with a single parent tenancy. I need to fetch the costs of those child tenancies with parent tenancies using Usage API calls.
@adizohar, can you guide me on how to achieve this?.

import oci

config = oci.config.from_file()
tenant_id = config['tenancy']
time_usage_started = "2024-04-01T00:00:00Z"
time_usage_ended = "2024-04-21T00:00:00Z"
lis=[]
usage_client = oci.usage_api.UsageapiClient(config,timeout=(10,3000))

requestSummarizedUsagesDetails = oci.usage_api.models.RequestSummarizedUsagesDetails(
    tenant_id=tenant_id,
    granularity='DAILY',
    query_type='USAGE',
    group_by=[ 'resourceId','service','compartmentName'],
    time_usage_started=time_usage_started,
    time_usage_ended=time_usage_ended,
    compartment_depth=2
)
# CUSTOM_RETRY_STRATEGY = RetryStrategyBuilder().add_max_attempts(max_attempts=8) \
#     .add_total_elapsed_time(total_elapsed_time_seconds=25000) \
#     .add_service_error_check(service_error_retry_config=retry_checkers.RETRYABLE_STATUSES_AND_CODES,
#                              service_error_retry_on_any_5xx=True) \
#     .get_retry_strategy()

# Retrieve summarized usage data
request_summarized_usages = usage_client.request_summarized_usages(
    requestSummarizedUsagesDetails,
    retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY
)

for item in request_summarized_usages.data.items:
    print(len(item.resource_id))
主要言語
Python
スター
474
フォーク
321
平均マージ
23分
マージ済み PR(30日)
4

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

oracle/oci-python-sdk のほかの issue

oracle/oci-python-sdk の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。