Cost Explorer クエリ プロセスを 1 つ作成
指定されたパラメーターに対して、Cost Explorer 内でクエリ プロセスを作成します。クエリのステータスをポーリングし、最終的に結果を取得するために使用できるトークンが返されます。
path パラメータ
-
プロジェクトを含む組織を識別する一意の 24 桁の 16 進数文字列。 認証済みユーザーがアクセスできるすべての組織を取得するには、 /orgs エンドポイントを使用します。
形式は次のパターンと一致する必要があります:
^([a-f0-9]{24})$
。
クエリ パラメータ
-
アプリケーションがレスポンスを
envelope
JSON オブジェクトにラップするかどうかを示すフラグ。一部の API クライアントは、HTTP レスポンス ヘッダーまたはステータス コードにアクセスできません。これを修正するには、クエリで envelope=true を設定します。結果のリストを返すエンドポイントは、結果オブジェクトをエンベロープとして使用します。アプリケーションは、レスポンス本体にステータス パラメータを追加します。デフォルト値は
false
です。
body
必須
Cost Explorer クエリのフィルター パラメーター。
-
Cost Explorer クエリに含めるクラスターのリスト。
各 の形式は次のパターンと一致する必要があります:
^([a-f0-9]{24})$
。 -
Cost Explorer クエリの排他的終了日(終了日は範囲に含まれません)。日付は月の初めを指定する必要があります。
-
返された使用結果をグループ化する単位。使用する単位には、少なくとも 1 つのフィルター値を指定する必要があります。
値は、
organizations
、projects
、clusters
、またはservices
です。 -
フィルター条件と一致するが、すべてのフィルター条件に値がない使用を応答に含めるかどうかを制御するフラグ。デフォルトは false で、部分的に一致するデータは除外されます。
-
Cost Explorer クエリに含める組織のリスト。
各 の形式は次のパターンと一致する必要があります:
^([a-f0-9]{24})$
。 -
Cost Explorer クエリに含めるプロジェクトのリスト。
各 の形式は次のパターンと一致する必要があります:
^([a-f0-9]{24})$
。 -
Cost Explorer クエリに含める SKU サービスのリスト。
値は
Atlas
、Clusters
、Storage
、Serverless Instances
、Backup
、Data Transfer
、BI Connector
、Premium Features
、Atlas Data Federation
、Atlas Stream Processing
、App Services
、Charts
、Cloud Manager
、Cloud Manager Standard/Premium
、Legacy Backup
、Flex Consulting
、Support
、またはCredits
。 -
Cost Explorer クエリの包括的開始日(開始日は範囲に含まれます)。日付は月の初めを指定する必要があります。
atlas api invoices createOrgBillingCostExplorerUsageProcess --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20231115001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.CreateOrgBillingCostExplorerUsageProcessApiParams{}
sdkResp, httpResp, err := client.InvoicesApi.
CreateOrgBillingCostExplorerUsageProcessWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2023-11-15+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/billing/costExplorer/usage" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2023-11-15+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/orgs/{orgId}/billing/costExplorer/usage" \
-d '{ <Payload> }'
{
"clusters": [
"32b6e34b3d91647abb20e7b8"
],
"endDate": "2025-05-04",
"groupBy": "organizations",
"includePartialMatches": true,
"organizations": [
"32b6e34b3d91647abb20e7b8"
],
"projects": [
"32b6e34b3d91647abb20e7b8"
],
"services": [
"Atlas"
],
"startDate": "2025-05-04"
}
{
"token": "d9ab638a801efe182f98ae3e18ea4bb47b9fda808a28a8c7de205bb0e94f7d71"
}
{
"error": 400,
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"reason": "Bad Request",
"errorCode": "VALIDATION_ERROR"
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}