diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 5ff5da6..e2ea7a9 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: 897b2045-55e2-49ca-a37b-2daf10d4e6ea management: - docChecksum: 4353aad0a1f8d81581b43bdce3806df7 + docChecksum: 5f5556c2cd53d11fec482c6dbb46d5cb docVersion: "1.0" speakeasyVersion: 1.795.1 generationVersion: 2.932.9 - releaseVersion: 0.5.1 - configChecksum: 3915af418dfcaa603e18e98b2ead771e + releaseVersion: 0.5.2 + configChecksum: 09842fbce8a4cb405339ddc292436358 repoURL: https://github.com/criblio/cribl_cloud_management_sdk_python.git installationURL: https://github.com/criblio/cribl_cloud_management_sdk_python.git published: true persistentEdits: - generation_id: 504fe599-3ccd-422f-96d4-9392a4dad5c2 - pristine_commit_hash: 53772b83289f027a4253bc424f1b38a55a383cb2 - pristine_tree_hash: d5895d4860022da1f9661fe13fed3e2b196c9a0e + generation_id: 536de02b-d5e9-4535-8aec-b617360664b2 + pristine_commit_hash: 583a3648246d5d122f1af7b1bc724ad24ddd9b74 + pristine_tree_hash: 0dca373554c48abb17b60b393d37eb1efa7118b1 features: python: additionalDependencies: 1.1.0 @@ -88,6 +88,50 @@ trackedFiles: id: 735a837faa57 last_write_checksum: sha1:bbe8a4e230f93c49ee1583811f1205f1ae0bc248 pristine_git_object: 570071c3d5e1ff3e0a4db80df942a368133bc533 + docs/models/billingwindow.md: + id: 6e441be8c550 + last_write_checksum: sha1:1083233d805c2443c98f5a80692800210968f1bb + pristine_git_object: a7dc7fc17b354f7daff41ce44ac2eb55cd67df22 + docs/models/contractsutilizationresponsedto.md: + id: cb27ae3b425a + last_write_checksum: sha1:7d9f2a49b6b09d6edc4a9c0afba8e64bd4d7e6ff + pristine_git_object: b751d415fa44768fd2092851897537b6bf1bd9b6 + docs/models/contractutilizationschema.md: + id: 6346c1422ea9 + last_write_checksum: sha1:ee91dd02407e773f516c3893a586f32136e42550 + pristine_git_object: 36e5e50f635438aaaa0ecec3289b81fa77d9a1bd + docs/models/creditgrantschema.md: + id: 4b48d505fc80 + last_write_checksum: sha1:0255d4f8e3b04d4b8a876d8e33e0d04a0b3cc9ee + pristine_git_object: 9d9ea52e40bfd12f6c3742c7647581d0ae65d6e1 + docs/models/creditgrantsresponsedto.md: + id: bc25483d2089 + last_write_checksum: sha1:99fc799966385153333f22bbb4c55f1987d3b53a + pristine_git_object: 635f281a2411df1dac16f3b56e0fa8d96487ba94 + docs/models/creditsstatscontractschema.md: + id: c7e58e39d6fb + last_write_checksum: sha1:04ea438ab6ae67ade2c1c19c5c3100dcf06280a4 + pristine_git_object: 54292660cf3277dd24ee90b3987d9f6d09d73079 + docs/models/creditsstatsresponsedto.md: + id: a39e428ba2f9 + last_write_checksum: sha1:fe83ab77d34ced6c791e9e2e7b125a033bf4a669 + pristine_git_object: dc6ac29e0f8d3aa00068183395a2ec9bd21f1702 + docs/models/creditstimeseriesdimensionschema.md: + id: 51a681eeb81a + last_write_checksum: sha1:08c1e6341b3870179a1391604247c63b3ca1feff + pristine_git_object: 404e6849e2ebdce1d512b679d130f8a8e3a2d4dc + docs/models/creditstimeseriesitemschema.md: + id: 6b5e58aa0abb + last_write_checksum: sha1:b8e65149d136430e3febb4c35a42d6929921dece + pristine_git_object: 6ec294b2c15f6fefcee44944b04ea5225670f220 + docs/models/creditstimeseriesresponsedto.md: + id: ccc31f05d592 + last_write_checksum: sha1:b62f84601952d274e241a8de8a1d25c018068e62 + pristine_git_object: e4cc1a7bf135427923e71692ba6e3baa1ea195a8 + docs/models/creditsutilizationitemschema.md: + id: 4b80ff3ea0f7 + last_write_checksum: sha1:f8394a0bd1df7df32a6158d791f248b75f1d4abd + pristine_git_object: 9fa5638d18e928673f626fc99ae320bf5377b7ac docs/models/defaulterrordto.md: id: 2faad791832c last_write_checksum: sha1:ce2e44ca6cc383ccf6547b2ee5e1785ef0615641 @@ -132,6 +176,10 @@ trackedFiles: id: e560b4e72643 last_write_checksum: sha1:230966cf92c3c094f644ee3670a596673c52eff5 pristine_git_object: 776c04e9d940a2630ce7ac616f7e321a35544255 + docs/models/type.md: + id: 98c32f09b2c8 + last_write_checksum: sha1:1cb019ff6b942fa3c2ed8142032cd83d4d22cc7d + pristine_git_object: 70cc293b06f267d35315ad870d7cfb65f0686432 docs/models/utils/retryconfig.md: id: 4343ac43161c last_write_checksum: sha1:562c0f21e308ad10c27f85f75704c15592c6929d @@ -168,6 +216,38 @@ trackedFiles: id: 6e5e37f76889 last_write_checksum: sha1:e1f3d3f83550ba2b8e177d6f2dd397101fe1468e pristine_git_object: 72359e3eed63ef4c0fefec848a4a3cd89f3dd55a + docs/models/v1billinggetcontractsutilizationrequest.md: + id: 870314218eb5 + last_write_checksum: sha1:64780a50a4dca3000c816d5a2430b5412943a80e + pristine_git_object: a18662cdfac03b2d84abf05b06af614d45136b08 + docs/models/v1billinggetcontractsutilizationresponse.md: + id: d8db215389ed + last_write_checksum: sha1:53407f638d5919b94d8d74e28844a422a9dbf001 + pristine_git_object: e3d06f2fb4f7b9e840c2910cdca9b09b1ca19875 + docs/models/v1billinggetcreditsgrantsrequest.md: + id: 0eca3c839f08 + last_write_checksum: sha1:d56d4169b4f7a8c2dd89d5164a70a592c4c70c94 + pristine_git_object: b0f262069f5611af4a855d4b3b11fc355529ad24 + docs/models/v1billinggetcreditsgrantsresponse.md: + id: d3bf3e95ced7 + last_write_checksum: sha1:17c9091d3c584459ca08d1e0e885e292bdaa1a4b + pristine_git_object: 51661f759cb46b0ed6f9724aa6ea92ee7953fad9 + docs/models/v1billinggetcreditsstatsrequest.md: + id: ecb3c140da34 + last_write_checksum: sha1:f8bdd03739d4720d3963569f9981131afa1d8828 + pristine_git_object: f26a952aeaa9bdabe300056e8024f2177c3f2a80 + docs/models/v1billinggetcreditsstatsresponse.md: + id: 5a050a5622ef + last_write_checksum: sha1:8612c9b7ed2352993e38405afb0b9b66ea812b73 + pristine_git_object: a75abcb7bdfaaa07d35eccbf98b9a6b5ef1b93c0 + docs/models/v1billinggetcreditstimeseriesrequest.md: + id: 233a56982a7c + last_write_checksum: sha1:0152e7eda01fdc6a6bb86042f1a292febbfbe3e6 + pristine_git_object: fbf4d915fd5208b672f8d54f3de679b3b23f8d9f + docs/models/v1billinggetcreditstimeseriesresponse.md: + id: f431f94af90f + last_write_checksum: sha1:d33132bc15ed5a10b9141dee4bf91d62e0721cbc + pristine_git_object: 900efa64db10facd089404293a6e404ccf765de8 docs/models/v1workspacescreateworkspacerequest.md: id: 1b3fa6b50705 last_write_checksum: sha1:17a18b3349612304a0d5470b405db87c1bf87c16 @@ -228,10 +308,26 @@ trackedFiles: id: 93fa0592990c last_write_checksum: sha1:cf711100d968364bdb4f351b6476179b3e139b1b pristine_git_object: e3062d8822ef2c6a2103d9d7162eab6371b77104 + docs/sdks/contractsutilization/README.md: + id: 6bdda6866a5b + last_write_checksum: sha1:1d11dbdcff3bd17b2dff1b88639cafa6fbe379f9 + pristine_git_object: 9bd3ebf122e7e15c34d2fcb7e7fd797bc11b57bd + docs/sdks/grants/README.md: + id: f4371a3352ee + last_write_checksum: sha1:abfc8a35a2337e825512f9ad46e76efe0254e76c + pristine_git_object: c40536c5463bd44d875355f15c25dc45ab8ca3f8 docs/sdks/health/README.md: id: 5082c50d5e82 last_write_checksum: sha1:b56f83a1ea293ad9b5fd76797122e09dccdbc1f9 pristine_git_object: 8bc80815563c358cd707d3a483cdb1bcf7f35ada + docs/sdks/stats/README.md: + id: 077d17163b5e + last_write_checksum: sha1:758a29cf1ad2e13ef8cfddc1d0bc17c5a9dc3ef0 + pristine_git_object: b50b16dce6fea4cb451e359d12dda9fa4e986737 + docs/sdks/timeseries/README.md: + id: d06d889b52fc + last_write_checksum: sha1:34412828229f95436918bf2fbabfda9211ba45f9 + pristine_git_object: af0c984de2854b4ac8f6a9f4fdaab369f6237f02 docs/sdks/workspaces/README.md: id: 1f5b051a6380 last_write_checksum: sha1:92bce1f765f2b179cfd9ee30551ff836682113dd @@ -250,8 +346,8 @@ trackedFiles: pristine_git_object: fde5e0418e98324b2b3b2a8e02559e575b2f6cfa pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:273e3da8b0869d5286b3ff25a4ea97734d74f760 - pristine_git_object: 03d34c00540183e391dd6753c3914da96bb42c42 + last_write_checksum: sha1:26a4d0a426a464f57fab7cd102538f67c6e01c5e + pristine_git_object: a52ff767bae2e017449ffa2725f8ad3f058cbef9 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:24bfcb3bc609310d0b86cb75ca844b42d4c9c248 @@ -282,8 +378,8 @@ trackedFiles: pristine_git_object: c4dbfc9dc2f712029811f523ecfa50bebebb13fc src/cribl_mgmt_plane/_version.py: id: 8ec199fcd31a - last_write_checksum: sha1:11e1ae260ddea69893b07ebfc15e9fc2bd5f3259 - pristine_git_object: 23c24c1d918608c1dd35e19594f296a1f51810dc + last_write_checksum: sha1:2c369fbd1377e511428fadabdc02b810389ab8ab + pristine_git_object: 7c0c862ee215d32e0630ec9f4431927b37114b8b src/cribl_mgmt_plane/apicredentials.py: id: d344dfa0de1f last_write_checksum: sha1:ba1681e1e3515d0fcdfe1b49e24c47f6eb2b6058 @@ -292,6 +388,18 @@ trackedFiles: id: 024a102b240a last_write_checksum: sha1:81612e29f97ca18085e9c029df956289aabbad29 pristine_git_object: a062bb974e91d9389cbedfdbd53df1f7e1f5a6d0 + src/cribl_mgmt_plane/billing.py: + id: 1bbea1aca796 + last_write_checksum: sha1:86c4cf4644c5d1bf47f3f37f99116e4fcfe23022 + pristine_git_object: ecbcd38eba7404f30707f677c4f62903175f5c03 + src/cribl_mgmt_plane/contractsutilization.py: + id: a85e77451df7 + last_write_checksum: sha1:260b975f17f88b4f9174c3b010bb3c44a16e0d2a + pristine_git_object: a719c76a7e1034960413ee32ca0145389022941c + src/cribl_mgmt_plane/credits.py: + id: 42b9314bc20c + last_write_checksum: sha1:f94cbde087ab9f4c45eea74270557517524a922f + pristine_git_object: 200e446f70161b520167eca493cd6bb4b22c462a src/cribl_mgmt_plane/errors/__init__.py: id: 53763ce236b6 last_write_checksum: sha1:959bb14a8cad993c700d93bec2ee8ce68833270c @@ -316,6 +424,10 @@ trackedFiles: id: 9b82814c3808 last_write_checksum: sha1:3dc59494bfdb04e31656725edf9a09486cfb4ea9 pristine_git_object: a67105e0edc3fc0e672262a1e7ac94557259a656 + src/cribl_mgmt_plane/grants.py: + id: bb6da428e078 + last_write_checksum: sha1:55bd80e23d921dfa9208f47b12cb38d6b74394a8 + pristine_git_object: 8e287d965c466f3e6959838a74c4bd5f7ecbf667 src/cribl_mgmt_plane/health.py: id: 5e82c1604c10 last_write_checksum: sha1:fdb81efa8222af500ebe331617f05ab431dc874f @@ -326,8 +438,8 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/cribl_mgmt_plane/models/__init__.py: id: c0ef0c636a04 - last_write_checksum: sha1:c256692565e1085b4adaafccbc4f25089bd0eaab - pristine_git_object: e1224e65597bc576685eef30f7f105ccba9c4b6a + last_write_checksum: sha1:92cece064e61a1658184dc348ebda640c6f59c31 + pristine_git_object: 7bae479a9ccd9ad14b926f1aac3363d98c6c1d1d src/cribl_mgmt_plane/models/apicredentialcreaterequestdto.py: id: 36936da257f5 last_write_checksum: sha1:077ebc07be73a76f95001c2386236118cdffc69e @@ -352,6 +464,50 @@ trackedFiles: id: e3cf6456c637 last_write_checksum: sha1:a8bfeb030ce11b845dd81092336dbcca69f27c87 pristine_git_object: 26d5b6a645ca442bf8b2358235353ea7fe3a6c27 + src/cribl_mgmt_plane/models/billingwindow.py: + id: 0dea10e1f9b8 + last_write_checksum: sha1:5468fbda30b36c7fc0b736f04bf2123dfd0efffb + pristine_git_object: b3c1279ffc996684b9c1bb2b53f892cac70aa5dc + src/cribl_mgmt_plane/models/contractsutilizationresponsedto.py: + id: e822658d148d + last_write_checksum: sha1:41eb5f3f427367d01af057de2cc663e22db0e425 + pristine_git_object: 249ffc9a02ceded1eedc7de875e8c3486b600b4b + src/cribl_mgmt_plane/models/contractutilizationschema.py: + id: 56d0043d3a7c + last_write_checksum: sha1:f4ed3f4a80ba992e156c8f8261f993e0946f6ddb + pristine_git_object: ceff4e9658aff4083eb388f9b977892bc4f046f9 + src/cribl_mgmt_plane/models/creditgrantschema.py: + id: fd33f116cf14 + last_write_checksum: sha1:b84912576b90ead7aed5469d83a4a7a6c1063d48 + pristine_git_object: 6493679023379f988efe8cd199ea7e32e374d896 + src/cribl_mgmt_plane/models/creditgrantsresponsedto.py: + id: 1eb6c45195f9 + last_write_checksum: sha1:f0d028e32dbb53e83a268d3f79d23700b77ea45d + pristine_git_object: 522842f28f8e4ebb869db0a03aedb50e5d0f2fb0 + src/cribl_mgmt_plane/models/creditsstatscontractschema.py: + id: bfa28c865994 + last_write_checksum: sha1:b5c2b4f17b4635ea99280669163c1fe926765c20 + pristine_git_object: b379ee0cf43afccde87f1f43c3605532550eaa33 + src/cribl_mgmt_plane/models/creditsstatsresponsedto.py: + id: 64beb5e454d3 + last_write_checksum: sha1:92ea61700979fc4137c6cccc699aff413e07e261 + pristine_git_object: 0ea47615553e259a8dfac89f0b4faed3f07b60cd + src/cribl_mgmt_plane/models/creditstimeseriesdimensionschema.py: + id: 2bf7b6fad0bf + last_write_checksum: sha1:0d6b56ea5876e536d2d42fe6b558cf4e8a0455ea + pristine_git_object: 905dbf24c60df5d1f31c57a5512abe2a976731e2 + src/cribl_mgmt_plane/models/creditstimeseriesitemschema.py: + id: dbde1e82a7be + last_write_checksum: sha1:7a7d799665336796ccd0d319afa9b78054c6c350 + pristine_git_object: a0e12c8c5915e7c36624bb899ddc44892b96aec1 + src/cribl_mgmt_plane/models/creditstimeseriesresponsedto.py: + id: f3370b4771cd + last_write_checksum: sha1:8f421841de52335fe2dcc58d2882c17467c7cac0 + pristine_git_object: e3bbf05692112dd06ec1e2bc0ae784ad5173c47c + src/cribl_mgmt_plane/models/creditsutilizationitemschema.py: + id: 6163b4fb0115 + last_write_checksum: sha1:533a3e2c0ac8c6e0648cd5b118136ee21339a997 + pristine_git_object: 1dc3bc7ae42e9989185f8169cac48592f8cd002f src/cribl_mgmt_plane/models/defaulterrordto.py: id: 76f1b582a83f last_write_checksum: sha1:8c7790b7fb0204368cca2403cfbe364c32ee959f @@ -392,6 +548,22 @@ trackedFiles: id: ad17f55e1646 last_write_checksum: sha1:71bc290df7dc2857aee51d99c0dede0a7fa26cd8 pristine_git_object: b45c8e0974ebcd45604f1ff14700ad4ab95f52de + src/cribl_mgmt_plane/models/v1_billing_getcontractsutilizationop.py: + id: 229de0f1a7b2 + last_write_checksum: sha1:3354f4d00f155ba0a8b6ec6306b0902fff6b9e76 + pristine_git_object: e3f4bc44d0e65ff3a5ed58557328521ff49891db + src/cribl_mgmt_plane/models/v1_billing_getcreditsgrantsop.py: + id: 48db7635db7a + last_write_checksum: sha1:2cece71ff86d3bab777e516cd21baa64c80efcb1 + pristine_git_object: 22252d4bbec138eb6e0062bf89d47e9cf84a0c78 + src/cribl_mgmt_plane/models/v1_billing_getcreditsstatsop.py: + id: d9c08c340571 + last_write_checksum: sha1:809273de0cbe44f17ba6e96ef198cc58fec737b2 + pristine_git_object: aff3d315e64439d9b50740c2fe230de95269b29f + src/cribl_mgmt_plane/models/v1_billing_getcreditstimeseriesop.py: + id: 00c34be4a53d + last_write_checksum: sha1:ce7b95fe0a18f6be1723589d5b6cfe40379cb8c0 + pristine_git_object: af653ebfe0d46b2b11036fa0f3efb5966a5c9360 src/cribl_mgmt_plane/models/v1_workspaces_createworkspaceop.py: id: 09e69d4b9704 last_write_checksum: sha1:89c6c500183884e777acf1154dc6210c90fb7e67 @@ -438,12 +610,20 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 src/cribl_mgmt_plane/sdk.py: id: 61b8e256ad47 - last_write_checksum: sha1:8c70dfc78ad514e5fc41a24e6086525669116748 - pristine_git_object: 4482439bd30d3432a905dd2b9670b5f8db5566f6 + last_write_checksum: sha1:791687818c02009d2ec089c8674d775740536475 + pristine_git_object: 5de5c7d7c5eef8daaf97ca9c430a4d35bf5af56f src/cribl_mgmt_plane/sdkconfiguration.py: id: 31a3f1e28307 last_write_checksum: sha1:008d083f213b1f7dacd0c7970dfd224e0c13c39c pristine_git_object: 65c499c66e905195a345a02c21a0050685df6926 + src/cribl_mgmt_plane/stats.py: + id: a853ee2c8ed6 + last_write_checksum: sha1:a46ed4e9b4eedddc13c7db4147efa86283646a6e + pristine_git_object: 4e24e163f81d29acec89438868855461e68154d7 + src/cribl_mgmt_plane/timeseries.py: + id: 2cb5f584ad68 + last_write_checksum: sha1:bf282bc97242d34e7462e61d32e858a2b5ffcb19 + pristine_git_object: 417f123995f5b7c8f2ccd26440a8aadc523a8e8e src/cribl_mgmt_plane/types/__init__.py: id: ac748e42a9e7 last_write_checksum: sha1:f9ad14217f832e74f594285960125add50324be9 @@ -651,23 +831,69 @@ examples: application/json: {"name": "Auto-Manage-Workspaces", "description": "Used for automated Workspace management", "enabled": true, "organizationId": "org-123", "clientId": "clientIdabcd1234EXAMPLE", "roles": {"organizationRole": "admin", "workspaces": [{"workspaceId": "main", "workspaceRole": "admin", "products": [{"product": "stream", "role": "admin"}]}]}, "ipAllowlist": ["10.0.0.1/32"], "createdBy": "user@example.com", "createdDate": "2024-08-15T12:34:56Z", "lastUpdatedBy": "user@example.com", "lastUpdatedDate": "2024-08-15T12:34:56Z"} default: application/json: {"statusCode": 6805.09, "message": ""} + v1.billing.getContractsUtilization: + speakeasy-default-v1-billing-get-contracts-utilization: + parameters: + path: + organizationId: "" + query: + startingOn: "2025-05-01T00:00:00Z" + endingBefore: "2025-06-01T00:00:00Z" + window: "monthly" + responses: + "200": + application/json: {"contracts": []} + default: + application/json: {"statusCode": 400, "message": "Bad Request"} + v1.billing.getCreditsTimeseries: + speakeasy-default-v1-billing-get-credits-timeseries: + parameters: + path: + organizationId: "" + query: + startingOn: "2025-05-01T00:00:00Z" + endingBefore: "2025-06-01T00:00:00Z" + window: "monthly" + responses: + "200": + application/json: {"items": [{"date": "2025-05-01T00:00:00Z", "credits": 147722.92, "dimensions": [{"dimension": "stream", "credits": 42150.5}]}], "count": 12} + default: + application/json: {"statusCode": 400, "message": "Bad Request"} + v1.billing.getCreditsStats: + speakeasy-default-v1-billing-get-credits-stats: + parameters: + path: + organizationId: "" + query: + startingOn: "2025-05-01T00:00:00Z" + endingBefore: "2025-06-01T00:00:00Z" + responses: + "200": + application/json: {"totalCreditsRemaining": 5127123.69, "totalCreditsUsed": 2555625.49, "totalCreditsAcquired": 11061354.6, "contracts": [{"startDate": "2025-09-17T00:00:00Z", "endDate": "2026-08-02T00:00:00Z"}]} + default: + application/json: {"statusCode": 400, "message": "Bad Request"} + v1.billing.getCreditsGrants: + speakeasy-default-v1-billing-get-credits-grants: + parameters: + path: + organizationId: "" + query: + startingOn: "2025-05-01T00:00:00Z" + endingBefore: "2025-06-01T00:00:00Z" + responses: + "200": + application/json: {"items": [{"date": "2025-10-29T00:00:00Z", "creditsAcquired": 6000000, "type": "Purchased"}], "count": 3} + default: + application/json: {"statusCode": 400, "message": "Bad Request"} examplesVersion: 1.0.2 generatedTests: dummyServiceStatus: "2025-07-02T19:49:08+02:00" releaseNotes: | - ## Python SDK Changes - - This version of the SDK is generated for Cribl.Cloud. - - ### API Credentials — Insights product - - `insights` is now a valid product on API credential workspace roles: set on create and update; returned on list and get. - - * `cribl_mgmt_plane.api_credentials.list()` — `response.items[].roles.workspaces[].products[].product` (`insights`) - * `cribl_mgmt_plane.api_credentials.create()` — `request.roles.workspaces[].products[].product`; `response.roles.workspaces[].products[].product` (`insights`) - * `cribl_mgmt_plane.api_credentials.update()` — `request.roles.workspaces[].products[].product` (`insights`) - * `cribl_mgmt_plane.api_credentials.get()` — `response.roles.workspaces[].products[].product` (`insights`) - + ## Python SDK Changes: + * `cribl_mgmt_plane.billing.credits.contracts_utilization.list()`: **Added** + * `cribl_mgmt_plane.billing.credits.timeseries.list()`: **Added** + * `cribl_mgmt_plane.billing.credits.stats.list()`: **Added** + * `cribl_mgmt_plane.billing.credits.grants.list()`: **Added** generatedFiles: - .devcontainer/README.md - .devcontainer/devcontainer.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index ed98175..a59cfd3 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -33,7 +33,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false python: - version: 0.5.1 + version: 0.5.2 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 26c711a..d3a0bb5 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -211,6 +211,232 @@ paths: - apiCredentials x-speakeasy-group: apiCredentials x-speakeasy-name-override: get + /v1/organizations/{organizationId}/billing/credits/contracts-utilization: + get: + description: Get cumulative credit utilization data grouped by contract period + for the specified Organization. + operationId: v1.billing.getContractsUtilization + parameters: + - name: organizationId + required: true + in: path + description: The id of the Organization. + schema: + type: string + - name: startingOn + required: true + in: query + description: "Inclusive start of the query date range in ISO 8601 format. Must + be before endingBefore. Minimum range is 1 day. Maximum range + depends on window: 6 months for daily, 7 years for monthly." + schema: + format: date-time + example: 2025-05-01T00:00:00.000Z + type: string + - name: endingBefore + required: true + in: query + description: "Exclusive end of the query date range in ISO 8601 format. Must be + after startingOn. Minimum range is 1 day. Maximum range depends on + window: 6 months for daily, 7 years for monthly." + schema: + format: date-time + example: 2025-06-01T00:00:00.000Z + type: string + - name: window + required: true + in: query + description: "Aggregation granularity for credit utilization data. Determines + the maximum allowed date range: up to 6 months for daily, up to 7 + years for monthly." + schema: + $ref: "#/components/schemas/BillingWindow" + responses: + "200": + description: Contract credit utilization data. + content: + application/json: + schema: + $ref: "#/components/schemas/ContractsUtilizationResponseDTO" + "503": + description: FinOps endpoints are in development with restricted availability. + Contact Cribl Support to request access. + default: + description: Default error response + content: + application/json: + schema: + $ref: "#/components/schemas/DefaultErrorDTO" + summary: Get contract credit utilization + tags: + - billing + x-speakeasy-group: billing.credits.contractsUtilization + x-speakeasy-name-override: list + /v1/organizations/{organizationId}/billing/credits/timeseries: + get: + description: Get credit consumption timeseries data for the specified + Organization, broken down by dimensions such as product and usage type. + operationId: v1.billing.getCreditsTimeseries + parameters: + - name: organizationId + required: true + in: path + description: The id of the Organization. + schema: + type: string + - name: startingOn + required: true + in: query + description: "Inclusive start of the query date range in ISO 8601 format. Must + be before endingBefore. Minimum range is 1 day. Maximum range + depends on window: 6 months for daily, 7 years for monthly." + schema: + format: date-time + example: 2025-05-01T00:00:00.000Z + type: string + - name: endingBefore + required: true + in: query + description: "Exclusive end of the query date range in ISO 8601 format. Must be + after startingOn. Minimum range is 1 day. Maximum range depends on + window: 6 months for daily, 7 years for monthly." + schema: + format: date-time + example: 2025-06-01T00:00:00.000Z + type: string + - name: window + required: true + in: query + description: "Aggregation granularity for timeseries data. Determines the + maximum allowed date range: up to 6 months for daily, up to 7 years + for monthly." + schema: + $ref: "#/components/schemas/BillingWindow" + responses: + "200": + description: Credits timeseries data. + content: + application/json: + schema: + $ref: "#/components/schemas/CreditsTimeseriesResponseDTO" + "503": + description: FinOps endpoints are in development with restricted availability. + Contact Cribl Support to request access. + default: + description: Default error response + content: + application/json: + schema: + $ref: "#/components/schemas/DefaultErrorDTO" + summary: Get credits timeseries + tags: + - billing + x-speakeasy-group: billing.credits.timeseries + x-speakeasy-name-override: list + /v1/organizations/{organizationId}/billing/credits/stats: + get: + description: Get credit balance totals, consumption totals, and contract date + ranges for the specified Organization. + operationId: v1.billing.getCreditsStats + parameters: + - name: organizationId + required: true + in: path + description: The id of the Organization. + schema: + type: string + - name: startingOn + required: true + in: query + description: Inclusive start of the query date range in ISO 8601 format. Must be + before endingBefore. Minimum range is 1 day. Maximum range is 7 + years. + schema: + format: date-time + example: 2025-05-01T00:00:00.000Z + type: string + - name: endingBefore + required: true + in: query + description: Exclusive end of the query date range in ISO 8601 format. Must be + after startingOn. Minimum range is 1 day. Maximum range is 7 years. + schema: + format: date-time + example: 2025-06-01T00:00:00.000Z + type: string + responses: + "200": + description: Credit balance and consumption totals. + content: + application/json: + schema: + $ref: "#/components/schemas/CreditsStatsResponseDTO" + "503": + description: FinOps endpoints are in development with restricted availability. + Contact Cribl Support to request access. + default: + description: Default error response + content: + application/json: + schema: + $ref: "#/components/schemas/DefaultErrorDTO" + summary: Get credit balance and consumption + tags: + - billing + x-speakeasy-group: billing.credits.stats + x-speakeasy-name-override: list + /v1/organizations/{organizationId}/billing/credits/grants: + get: + description: Get credit grants (purchases, rollovers, and refunds) for the + specified Organization. + operationId: v1.billing.getCreditsGrants + parameters: + - name: organizationId + required: true + in: path + description: The id of the Organization. + schema: + type: string + - name: startingOn + required: true + in: query + description: Inclusive start of the query date range in ISO 8601 format. Must be + before endingBefore. Minimum range is 1 day. Maximum range is 7 + years. + schema: + format: date-time + example: 2025-05-01T00:00:00.000Z + type: string + - name: endingBefore + required: true + in: query + description: Exclusive end of the query date range in ISO 8601 format. Must be + after startingOn. Minimum range is 1 day. Maximum range is 7 years. + schema: + format: date-time + example: 2025-06-01T00:00:00.000Z + type: string + responses: + "200": + description: Credit grants for the queried period. + content: + application/json: + schema: + $ref: "#/components/schemas/CreditGrantsResponseDTO" + "503": + description: FinOps endpoints are in development with restricted availability. + Contact Cribl Support to request access. + default: + description: Default error response + content: + application/json: + schema: + $ref: "#/components/schemas/DefaultErrorDTO" + summary: Get credit grants + tags: + - billing + x-speakeasy-group: billing.credits.grants + x-speakeasy-name-override: list /v1/organizations/{organizationId}/workspaces: post: description: Create a new Workspace in the specified Organization. @@ -387,6 +613,8 @@ info: tags: - name: apiCredentials description: Operations related to API credentials + - name: billing + description: Operations related to Billing and FinOps data - name: workspaces description: Operations related to Workspaces - name: health @@ -727,6 +955,194 @@ components: type: array items: type: string + CreditsUtilizationItemSchema: + type: object + properties: + date: + format: date-time + type: string + description: Date of the aggregation window in ISO 8601 format. + example: 2025-05-01T00:00:00.000Z + credits: + type: number + description: Number of credits consumed in the aggregation window. + example: 147722.91698535177 + required: + - date + - credits + ContractUtilizationSchema: + type: object + properties: + contractStartDate: + format: date-time + type: string + description: Contract start date in ISO 8601 format. + example: 2025-04-29T00:00:00.000Z + contractEndDate: + format: date-time + type: string + description: Contract end date in ISO 8601 format. Present only when the + contract is closed. + example: 2025-05-30T00:00:00.000Z + items: + description: Cumulative credit utilization entries for the contract. + type: array + items: + $ref: "#/components/schemas/CreditsUtilizationItemSchema" + required: + - contractStartDate + - items + ContractsUtilizationResponseDTO: + type: object + properties: + contracts: + description: Contract utilization data, grouped by contract period. + type: array + items: + $ref: "#/components/schemas/ContractUtilizationSchema" + required: + - contracts + BillingWindow: + type: string + enum: + - monthly + - daily + x-speakeasy-unknown-values: allow + CreditsTimeseriesDimensionSchema: + type: object + properties: + dimension: + type: string + description: Dimension label for the credit breakdown. + example: stream + credits: + type: number + description: Number of credits attributed to the dimension. + example: 42150.5 + required: + - dimension + - credits + CreditsTimeseriesItemSchema: + type: object + properties: + date: + format: date-time + type: string + description: Date of the aggregation window in ISO 8601 format. + example: 2025-05-01T00:00:00.000Z + credits: + type: number + description: Total credits consumed in the aggregation window. + example: 147722.92 + dimensions: + description: Credit breakdown by dimension. + type: array + items: + $ref: "#/components/schemas/CreditsTimeseriesDimensionSchema" + required: + - date + - credits + - dimensions + CreditsTimeseriesResponseDTO: + type: object + properties: + items: + description: Credit timeseries data points. + type: array + items: + $ref: "#/components/schemas/CreditsTimeseriesItemSchema" + count: + type: integer + description: Total number of items in the response. + example: 12 + required: + - items + - count + CreditsStatsContractSchema: + type: object + properties: + startDate: + format: date-time + type: string + description: Contract start date in ISO 8601 format. + example: 2025-09-17T00:00:00.000Z + endDate: + format: date-time + type: string + description: Contract end date in ISO 8601 format. Present only when the + contract is closed. + example: 2026-08-02T00:00:00.000Z + required: + - startDate + CreditsStatsResponseDTO: + type: object + properties: + totalCreditsRemaining: + type: number + description: Total credits remaining across all contracts. + example: 5127123.69 + totalCreditsUsed: + type: number + description: Total credits consumed across all contracts. + example: 2555625.49 + totalCreditsAcquired: + type: number + description: Total credits acquired across all contracts. + example: 11061354.6 + contracts: + description: Contract periods ordered by contract start date in reverse + chronological order (newest first). + type: array + items: + $ref: "#/components/schemas/CreditsStatsContractSchema" + required: + - totalCreditsRemaining + - totalCreditsUsed + - totalCreditsAcquired + CreditGrantType: + type: string + enum: + - Refund + - Rollover + - Purchased + description: Type of the credit grant. + x-speakeasy-unknown-values: allow + CreditGrantSchema: + type: object + properties: + date: + format: date-time + type: string + description: Date the grant was issued, in ISO 8601 format. + example: 2025-10-29T00:00:00.000Z + creditsAcquired: + type: number + description: Number of credits acquired by the grant. + example: 6000000 + type: + description: Type of the credit grant. + example: Purchased + allOf: + - $ref: "#/components/schemas/CreditGrantType" + required: + - date + - creditsAcquired + - type + CreditGrantsResponseDTO: + type: object + properties: + items: + description: Credit grants for the queried period. + type: array + items: + $ref: "#/components/schemas/CreditGrantSchema" + count: + type: integer + description: Total number of items in the response. + example: 3 + required: + - items + - count AWSRegions: type: string enum: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3755df7..37d5716 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.795.1 sources: Cribl Cloud Management API: sourceNamespace: cribl-cloud-management-api - sourceRevisionDigest: sha256:1eaa211c894b44b2abc6795067df9d2292386945b19ad82fbb863d769a8ea301 - sourceBlobDigest: sha256:eccfe34b7970af39365b1dfd2c0b84acb516f3fc1883022e065314dcf6c1c9a4 + sourceRevisionDigest: sha256:a3cbd4811cc6ecb69ebe169e733da93ad7bb92fcd0f4e9fd751fc3d9d88b864f + sourceBlobDigest: sha256:376d35549dd6d0be9af2b5acadea301bbc9e9fba03dd06efe5335e24b354c7f8 tags: - latest - "1.0" @@ -11,10 +11,10 @@ targets: cribl-mgmt-plane: source: Cribl Cloud Management API sourceNamespace: cribl-cloud-management-api - sourceRevisionDigest: sha256:1eaa211c894b44b2abc6795067df9d2292386945b19ad82fbb863d769a8ea301 - sourceBlobDigest: sha256:eccfe34b7970af39365b1dfd2c0b84acb516f3fc1883022e065314dcf6c1c9a4 + sourceRevisionDigest: sha256:a3cbd4811cc6ecb69ebe169e733da93ad7bb92fcd0f4e9fd751fc3d9d88b864f + sourceBlobDigest: sha256:376d35549dd6d0be9af2b5acadea301bbc9e9fba03dd06efe5335e24b354c7f8 codeSamplesNamespace: cribl-cloud-management-api-python-code-samples - codeSamplesRevisionDigest: sha256:2008a68aeba60bc6b71d090e02ad33b4e55e9432ccf05c8e0d619e19753780cc + codeSamplesRevisionDigest: sha256:2896550d095a2b21eff404f158540515900beac1266fb656c020b6454d80db15 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.795.1 diff --git a/README-PYPI.md b/README-PYPI.md index 78ac683..b7261a7 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -206,6 +206,22 @@ The [Cribl.Cloud Authentication Example](https://github.com/criblio/cribl_contro * [delete](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/apicredentials/README.md#delete) - Delete an API Credential * [get](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/apicredentials/README.md#get) - Get an API Credential +### [Billing.Credits.ContractsUtilization](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/contractsutilization/README.md) + +* [list](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/contractsutilization/README.md#list) - Get contract credit utilization + +### [Billing.Credits.Grants](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/grants/README.md) + +* [list](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/grants/README.md#list) - Get credit grants + +### [Billing.Credits.Stats](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/stats/README.md) + +* [list](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/stats/README.md#list) - Get credit balance and consumption + +### [Billing.Credits.Timeseries](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/timeseries/README.md) + +* [list](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/timeseries/README.md#list) - Get credits timeseries + ### [Health](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/health/README.md) * [get](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/health/README.md#get) - Get the health status of the application @@ -363,7 +379,7 @@ with CriblMgmtPlane( **Inherit from [`CriblMgmtPlaneError`](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/./src/cribl_mgmt_plane/errors/criblmgmtplaneerror.py)**: -* [`DefaultErrorDTO`](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/./src/cribl_mgmt_plane/errors/defaulterrordto.py): API Credential limit reached. Status code `422`. Applicable to 1 of 11 methods.* +* [`DefaultErrorDTO`](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/./src/cribl_mgmt_plane/errors/defaulterrordto.py): API Credential limit reached. Status code `422`. Applicable to 1 of 15 methods.* * [`ResponseValidationError`](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/./src/cribl_mgmt_plane/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute. diff --git a/README.md b/README.md index ac8ef1b..ff02225 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,22 @@ The [Cribl.Cloud Authentication Example](https://github.com/criblio/cribl_contro * [delete](docs/sdks/apicredentials/README.md#delete) - Delete an API Credential * [get](docs/sdks/apicredentials/README.md#get) - Get an API Credential +### [Billing.Credits.ContractsUtilization](docs/sdks/contractsutilization/README.md) + +* [list](docs/sdks/contractsutilization/README.md#list) - Get contract credit utilization + +### [Billing.Credits.Grants](docs/sdks/grants/README.md) + +* [list](docs/sdks/grants/README.md#list) - Get credit grants + +### [Billing.Credits.Stats](docs/sdks/stats/README.md) + +* [list](docs/sdks/stats/README.md#list) - Get credit balance and consumption + +### [Billing.Credits.Timeseries](docs/sdks/timeseries/README.md) + +* [list](docs/sdks/timeseries/README.md#list) - Get credits timeseries + ### [Health](docs/sdks/health/README.md) * [get](docs/sdks/health/README.md#get) - Get the health status of the application @@ -363,7 +379,7 @@ with CriblMgmtPlane( **Inherit from [`CriblMgmtPlaneError`](./src/cribl_mgmt_plane/errors/criblmgmtplaneerror.py)**: -* [`DefaultErrorDTO`](./src/cribl_mgmt_plane/errors/defaulterrordto.py): API Credential limit reached. Status code `422`. Applicable to 1 of 11 methods.* +* [`DefaultErrorDTO`](./src/cribl_mgmt_plane/errors/defaulterrordto.py): API Credential limit reached. Status code `422`. Applicable to 1 of 15 methods.* * [`ResponseValidationError`](./src/cribl_mgmt_plane/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute. diff --git a/RELEASES.md b/RELEASES.md index 6f3d247..79b59f8 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -388,4 +388,14 @@ Based on: ### Generated - [python v0.5.1] . ### Releases -- [PyPI v0.5.1] https://pypi.org/project/cribl-mgmt-plane/0.5.1 - . \ No newline at end of file +- [PyPI v0.5.1] https://pypi.org/project/cribl-mgmt-plane/0.5.1 - . + +## 2026-08-31 00:46:41 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.795.1 (2.932.9) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.5.2] . +### Releases +- [PyPI v0.5.2] https://pypi.org/project/cribl-mgmt-plane/0.5.2 - . \ No newline at end of file diff --git a/docs/models/billingwindow.md b/docs/models/billingwindow.md new file mode 100644 index 0000000..a7dc7fc --- /dev/null +++ b/docs/models/billingwindow.md @@ -0,0 +1,19 @@ +# BillingWindow + +## Example Usage + +```python +from cribl_mgmt_plane.models import BillingWindow + +value = BillingWindow.MONTHLY + +# Open enum: unrecognized values are captured as UnrecognizedStr +``` + + +## Values + +| Name | Value | +| --------- | --------- | +| `MONTHLY` | monthly | +| `DAILY` | daily | \ No newline at end of file diff --git a/docs/models/contractsutilizationresponsedto.md b/docs/models/contractsutilizationresponsedto.md new file mode 100644 index 0000000..b751d41 --- /dev/null +++ b/docs/models/contractsutilizationresponsedto.md @@ -0,0 +1,8 @@ +# ContractsUtilizationResponseDTO + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `contracts` | List[[models.ContractUtilizationSchema](../models/contractutilizationschema.md)] | :heavy_check_mark: | Contract utilization data, grouped by contract period. | \ No newline at end of file diff --git a/docs/models/contractutilizationschema.md b/docs/models/contractutilizationschema.md new file mode 100644 index 0000000..36e5e50 --- /dev/null +++ b/docs/models/contractutilizationschema.md @@ -0,0 +1,10 @@ +# ContractUtilizationSchema + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `contract_start_date` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Contract start date in ISO 8601 format. | 2025-04-29 00:00:00 +0000 UTC | +| `contract_end_date` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Contract end date in ISO 8601 format. Present only when the contract is closed. | 2025-05-30 00:00:00 +0000 UTC | +| `items` | List[[models.CreditsUtilizationItemSchema](../models/creditsutilizationitemschema.md)] | :heavy_check_mark: | Cumulative credit utilization entries for the contract. | | \ No newline at end of file diff --git a/docs/models/creditgrantschema.md b/docs/models/creditgrantschema.md new file mode 100644 index 0000000..9d9ea52 --- /dev/null +++ b/docs/models/creditgrantschema.md @@ -0,0 +1,10 @@ +# CreditGrantSchema + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `date_` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Date the grant was issued, in ISO 8601 format. | 2025-10-29 00:00:00 +0000 UTC | +| `credits_acquired` | *float* | :heavy_check_mark: | Number of credits acquired by the grant. | 6000000 | +| `type` | [models.Type](../models/type.md) | :heavy_check_mark: | Type of the credit grant. | Purchased | \ No newline at end of file diff --git a/docs/models/creditgrantsresponsedto.md b/docs/models/creditgrantsresponsedto.md new file mode 100644 index 0000000..635f281 --- /dev/null +++ b/docs/models/creditgrantsresponsedto.md @@ -0,0 +1,9 @@ +# CreditGrantsResponseDTO + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `items` | List[[models.CreditGrantSchema](../models/creditgrantschema.md)] | :heavy_check_mark: | Credit grants for the queried period. | | +| `count` | *int* | :heavy_check_mark: | Total number of items in the response. | 3 | \ No newline at end of file diff --git a/docs/models/creditsstatscontractschema.md b/docs/models/creditsstatscontractschema.md new file mode 100644 index 0000000..5429266 --- /dev/null +++ b/docs/models/creditsstatscontractschema.md @@ -0,0 +1,9 @@ +# CreditsStatsContractSchema + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `start_date` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Contract start date in ISO 8601 format. | 2025-09-17 00:00:00 +0000 UTC | +| `end_date` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Contract end date in ISO 8601 format. Present only when the contract is closed. | 2026-08-02 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/docs/models/creditsstatsresponsedto.md b/docs/models/creditsstatsresponsedto.md new file mode 100644 index 0000000..dc6ac29 --- /dev/null +++ b/docs/models/creditsstatsresponsedto.md @@ -0,0 +1,11 @@ +# CreditsStatsResponseDTO + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `total_credits_remaining` | *float* | :heavy_check_mark: | Total credits remaining across all contracts. | 5.12712369e+06 | +| `total_credits_used` | *float* | :heavy_check_mark: | Total credits consumed across all contracts. | 2.55562549e+06 | +| `total_credits_acquired` | *float* | :heavy_check_mark: | Total credits acquired across all contracts. | 1.10613546e+07 | +| `contracts` | List[[models.CreditsStatsContractSchema](../models/creditsstatscontractschema.md)] | :heavy_minus_sign: | Contract periods ordered by contract start date in reverse chronological order (newest first). | | \ No newline at end of file diff --git a/docs/models/creditstimeseriesdimensionschema.md b/docs/models/creditstimeseriesdimensionschema.md new file mode 100644 index 0000000..404e684 --- /dev/null +++ b/docs/models/creditstimeseriesdimensionschema.md @@ -0,0 +1,9 @@ +# CreditsTimeseriesDimensionSchema + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| `dimension` | *str* | :heavy_check_mark: | Dimension label for the credit breakdown. | stream | +| `credits` | *float* | :heavy_check_mark: | Number of credits attributed to the dimension. | 42150.5 | \ No newline at end of file diff --git a/docs/models/creditstimeseriesitemschema.md b/docs/models/creditstimeseriesitemschema.md new file mode 100644 index 0000000..6ec294b --- /dev/null +++ b/docs/models/creditstimeseriesitemschema.md @@ -0,0 +1,10 @@ +# CreditsTimeseriesItemSchema + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `date_` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Date of the aggregation window in ISO 8601 format. | 2025-05-01 00:00:00 +0000 UTC | +| `credits` | *float* | :heavy_check_mark: | Total credits consumed in the aggregation window. | 147722.92 | +| `dimensions` | List[[models.CreditsTimeseriesDimensionSchema](../models/creditstimeseriesdimensionschema.md)] | :heavy_check_mark: | Credit breakdown by dimension. | | \ No newline at end of file diff --git a/docs/models/creditstimeseriesresponsedto.md b/docs/models/creditstimeseriesresponsedto.md new file mode 100644 index 0000000..e4cc1a7 --- /dev/null +++ b/docs/models/creditstimeseriesresponsedto.md @@ -0,0 +1,9 @@ +# CreditsTimeseriesResponseDTO + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `items` | List[[models.CreditsTimeseriesItemSchema](../models/creditstimeseriesitemschema.md)] | :heavy_check_mark: | Credit timeseries data points. | | +| `count` | *int* | :heavy_check_mark: | Total number of items in the response. | 12 | \ No newline at end of file diff --git a/docs/models/creditsutilizationitemschema.md b/docs/models/creditsutilizationitemschema.md new file mode 100644 index 0000000..9fa5638 --- /dev/null +++ b/docs/models/creditsutilizationitemschema.md @@ -0,0 +1,9 @@ +# CreditsUtilizationItemSchema + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `date_` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Date of the aggregation window in ISO 8601 format. | 2025-05-01 00:00:00 +0000 UTC | +| `credits` | *float* | :heavy_check_mark: | Number of credits consumed in the aggregation window. | 147722.91698535177 | \ No newline at end of file diff --git a/docs/models/type.md b/docs/models/type.md new file mode 100644 index 0000000..70cc293 --- /dev/null +++ b/docs/models/type.md @@ -0,0 +1,22 @@ +# Type + +Type of the credit grant. + +## Example Usage + +```python +from cribl_mgmt_plane.models import Type + +value = Type.REFUND + +# Open enum: unrecognized values are captured as UnrecognizedStr +``` + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `REFUND` | Refund | +| `ROLLOVER` | Rollover | +| `PURCHASED` | Purchased | \ No newline at end of file diff --git a/docs/models/v1billinggetcontractsutilizationrequest.md b/docs/models/v1billinggetcontractsutilizationrequest.md new file mode 100644 index 0000000..a18662c --- /dev/null +++ b/docs/models/v1billinggetcontractsutilizationrequest.md @@ -0,0 +1,11 @@ +# V1BillingGetContractsUtilizationRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `organization_id` | *str* | :heavy_check_mark: | The id of the Organization. | | +| `starting_on` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. | 2025-05-01 00:00:00 +0000 UTC | +| `ending_before` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. | 2025-06-01 00:00:00 +0000 UTC | +| `window` | [models.BillingWindow](../models/billingwindow.md) | :heavy_check_mark: | Aggregation granularity for credit utilization data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly. | | \ No newline at end of file diff --git a/docs/models/v1billinggetcontractsutilizationresponse.md b/docs/models/v1billinggetcontractsutilizationresponse.md new file mode 100644 index 0000000..e3d06f2 --- /dev/null +++ b/docs/models/v1billinggetcontractsutilizationresponse.md @@ -0,0 +1,17 @@ +# V1BillingGetContractsUtilizationResponse + + +## Supported Types + +### `models.ContractsUtilizationResponseDTO` + +```python +value: models.ContractsUtilizationResponseDTO = /* values here */ +``` + +### `models.DefaultErrorDTO` + +```python +value: models.DefaultErrorDTO = /* values here */ +``` + diff --git a/docs/models/v1billinggetcreditsgrantsrequest.md b/docs/models/v1billinggetcreditsgrantsrequest.md new file mode 100644 index 0000000..b0f2620 --- /dev/null +++ b/docs/models/v1billinggetcreditsgrantsrequest.md @@ -0,0 +1,10 @@ +# V1BillingGetCreditsGrantsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `organization_id` | *str* | :heavy_check_mark: | The id of the Organization. | | +| `starting_on` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years. | 2025-05-01 00:00:00 +0000 UTC | +| `ending_before` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years. | 2025-06-01 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/docs/models/v1billinggetcreditsgrantsresponse.md b/docs/models/v1billinggetcreditsgrantsresponse.md new file mode 100644 index 0000000..51661f7 --- /dev/null +++ b/docs/models/v1billinggetcreditsgrantsresponse.md @@ -0,0 +1,17 @@ +# V1BillingGetCreditsGrantsResponse + + +## Supported Types + +### `models.CreditGrantsResponseDTO` + +```python +value: models.CreditGrantsResponseDTO = /* values here */ +``` + +### `models.DefaultErrorDTO` + +```python +value: models.DefaultErrorDTO = /* values here */ +``` + diff --git a/docs/models/v1billinggetcreditsstatsrequest.md b/docs/models/v1billinggetcreditsstatsrequest.md new file mode 100644 index 0000000..f26a952 --- /dev/null +++ b/docs/models/v1billinggetcreditsstatsrequest.md @@ -0,0 +1,10 @@ +# V1BillingGetCreditsStatsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `organization_id` | *str* | :heavy_check_mark: | The id of the Organization. | | +| `starting_on` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years. | 2025-05-01 00:00:00 +0000 UTC | +| `ending_before` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years. | 2025-06-01 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/docs/models/v1billinggetcreditsstatsresponse.md b/docs/models/v1billinggetcreditsstatsresponse.md new file mode 100644 index 0000000..a75abcb --- /dev/null +++ b/docs/models/v1billinggetcreditsstatsresponse.md @@ -0,0 +1,17 @@ +# V1BillingGetCreditsStatsResponse + + +## Supported Types + +### `models.CreditsStatsResponseDTO` + +```python +value: models.CreditsStatsResponseDTO = /* values here */ +``` + +### `models.DefaultErrorDTO` + +```python +value: models.DefaultErrorDTO = /* values here */ +``` + diff --git a/docs/models/v1billinggetcreditstimeseriesrequest.md b/docs/models/v1billinggetcreditstimeseriesrequest.md new file mode 100644 index 0000000..fbf4d91 --- /dev/null +++ b/docs/models/v1billinggetcreditstimeseriesrequest.md @@ -0,0 +1,11 @@ +# V1BillingGetCreditsTimeseriesRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `organization_id` | *str* | :heavy_check_mark: | The id of the Organization. | | +| `starting_on` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. | 2025-05-01 00:00:00 +0000 UTC | +| `ending_before` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. | 2025-06-01 00:00:00 +0000 UTC | +| `window` | [models.BillingWindow](../models/billingwindow.md) | :heavy_check_mark: | Aggregation granularity for timeseries data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly. | | \ No newline at end of file diff --git a/docs/models/v1billinggetcreditstimeseriesresponse.md b/docs/models/v1billinggetcreditstimeseriesresponse.md new file mode 100644 index 0000000..900efa6 --- /dev/null +++ b/docs/models/v1billinggetcreditstimeseriesresponse.md @@ -0,0 +1,17 @@ +# V1BillingGetCreditsTimeseriesResponse + + +## Supported Types + +### `models.CreditsTimeseriesResponseDTO` + +```python +value: models.CreditsTimeseriesResponseDTO = /* values here */ +``` + +### `models.DefaultErrorDTO` + +```python +value: models.DefaultErrorDTO = /* values here */ +``` + diff --git a/docs/sdks/contractsutilization/README.md b/docs/sdks/contractsutilization/README.md new file mode 100644 index 0000000..9bd3ebf --- /dev/null +++ b/docs/sdks/contractsutilization/README.md @@ -0,0 +1,58 @@ +# Billing.Credits.ContractsUtilization + +## Overview + +### Available Operations + +* [list](#list) - Get contract credit utilization + +## list + +Get cumulative credit utilization data grouped by contract period for the specified Organization. + +### Example Usage + + +```python +from cribl_mgmt_plane import CriblMgmtPlane, models +from cribl_mgmt_plane.utils import parse_datetime +import os + + +with CriblMgmtPlane( + security=models.Security( + client_oauth=models.SchemeClientOauth( + client_id=os.getenv("CRIBLMGMTPLANE_CLIENT_ID", ""), + client_secret=os.getenv("CRIBLMGMTPLANE_CLIENT_SECRET", ""), + token_url=os.getenv("CRIBLMGMTPLANE_TOKEN_URL", ""), + audience="https://api.cribl.cloud", + ), + ), +) as cmp_client: + + res = cmp_client.billing.credits.contracts_utilization.list(organization_id="", starting_on=parse_datetime("2025-05-01T00:00:00Z"), ending_before=parse_datetime("2025-06-01T00:00:00Z"), window=models.BillingWindow.MONTHLY) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `organization_id` | *str* | :heavy_check_mark: | The id of the Organization. | | +| `starting_on` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. | 2025-05-01 00:00:00 +0000 UTC | +| `ending_before` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. | 2025-06-01 00:00:00 +0000 UTC | +| `window` | [models.BillingWindow](../../models/billingwindow.md) | :heavy_check_mark: | Aggregation granularity for credit utilization data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly. | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[models.V1BillingGetContractsUtilizationResponse](../../models/v1billinggetcontractsutilizationresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/grants/README.md b/docs/sdks/grants/README.md new file mode 100644 index 0000000..c40536c --- /dev/null +++ b/docs/sdks/grants/README.md @@ -0,0 +1,57 @@ +# Billing.Credits.Grants + +## Overview + +### Available Operations + +* [list](#list) - Get credit grants + +## list + +Get credit grants (purchases, rollovers, and refunds) for the specified Organization. + +### Example Usage + + +```python +from cribl_mgmt_plane import CriblMgmtPlane, models +from cribl_mgmt_plane.utils import parse_datetime +import os + + +with CriblMgmtPlane( + security=models.Security( + client_oauth=models.SchemeClientOauth( + client_id=os.getenv("CRIBLMGMTPLANE_CLIENT_ID", ""), + client_secret=os.getenv("CRIBLMGMTPLANE_CLIENT_SECRET", ""), + token_url=os.getenv("CRIBLMGMTPLANE_TOKEN_URL", ""), + audience="https://api.cribl.cloud", + ), + ), +) as cmp_client: + + res = cmp_client.billing.credits.grants.list(organization_id="", starting_on=parse_datetime("2025-05-01T00:00:00Z"), ending_before=parse_datetime("2025-06-01T00:00:00Z")) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `organization_id` | *str* | :heavy_check_mark: | The id of the Organization. | | +| `starting_on` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years. | 2025-05-01 00:00:00 +0000 UTC | +| `ending_before` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years. | 2025-06-01 00:00:00 +0000 UTC | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[models.V1BillingGetCreditsGrantsResponse](../../models/v1billinggetcreditsgrantsresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/stats/README.md b/docs/sdks/stats/README.md new file mode 100644 index 0000000..b50b16d --- /dev/null +++ b/docs/sdks/stats/README.md @@ -0,0 +1,57 @@ +# Billing.Credits.Stats + +## Overview + +### Available Operations + +* [list](#list) - Get credit balance and consumption + +## list + +Get credit balance totals, consumption totals, and contract date ranges for the specified Organization. + +### Example Usage + + +```python +from cribl_mgmt_plane import CriblMgmtPlane, models +from cribl_mgmt_plane.utils import parse_datetime +import os + + +with CriblMgmtPlane( + security=models.Security( + client_oauth=models.SchemeClientOauth( + client_id=os.getenv("CRIBLMGMTPLANE_CLIENT_ID", ""), + client_secret=os.getenv("CRIBLMGMTPLANE_CLIENT_SECRET", ""), + token_url=os.getenv("CRIBLMGMTPLANE_TOKEN_URL", ""), + audience="https://api.cribl.cloud", + ), + ), +) as cmp_client: + + res = cmp_client.billing.credits.stats.list(organization_id="", starting_on=parse_datetime("2025-05-01T00:00:00Z"), ending_before=parse_datetime("2025-06-01T00:00:00Z")) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `organization_id` | *str* | :heavy_check_mark: | The id of the Organization. | | +| `starting_on` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years. | 2025-05-01 00:00:00 +0000 UTC | +| `ending_before` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years. | 2025-06-01 00:00:00 +0000 UTC | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[models.V1BillingGetCreditsStatsResponse](../../models/v1billinggetcreditsstatsresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/timeseries/README.md b/docs/sdks/timeseries/README.md new file mode 100644 index 0000000..af0c984 --- /dev/null +++ b/docs/sdks/timeseries/README.md @@ -0,0 +1,58 @@ +# Billing.Credits.Timeseries + +## Overview + +### Available Operations + +* [list](#list) - Get credits timeseries + +## list + +Get credit consumption timeseries data for the specified Organization, broken down by dimensions such as product and usage type. + +### Example Usage + + +```python +from cribl_mgmt_plane import CriblMgmtPlane, models +from cribl_mgmt_plane.utils import parse_datetime +import os + + +with CriblMgmtPlane( + security=models.Security( + client_oauth=models.SchemeClientOauth( + client_id=os.getenv("CRIBLMGMTPLANE_CLIENT_ID", ""), + client_secret=os.getenv("CRIBLMGMTPLANE_CLIENT_SECRET", ""), + token_url=os.getenv("CRIBLMGMTPLANE_TOKEN_URL", ""), + audience="https://api.cribl.cloud", + ), + ), +) as cmp_client: + + res = cmp_client.billing.credits.timeseries.list(organization_id="", starting_on=parse_datetime("2025-05-01T00:00:00Z"), ending_before=parse_datetime("2025-06-01T00:00:00Z"), window=models.BillingWindow.MONTHLY) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `organization_id` | *str* | :heavy_check_mark: | The id of the Organization. | | +| `starting_on` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. | 2025-05-01 00:00:00 +0000 UTC | +| `ending_before` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. | 2025-06-01 00:00:00 +0000 UTC | +| `window` | [models.BillingWindow](../../models/billingwindow.md) | :heavy_check_mark: | Aggregation granularity for timeseries data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly. | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[models.V1BillingGetCreditsTimeseriesResponse](../../models/v1billinggetcreditstimeseriesresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 03d34c0..a52ff76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "cribl-mgmt-plane" -version = "0.5.1" +version = "0.5.2" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Speakeasy" },] readme = "README-PYPI.md" diff --git a/src/cribl_mgmt_plane/_version.py b/src/cribl_mgmt_plane/_version.py index 23c24c1..7c0c862 100644 --- a/src/cribl_mgmt_plane/_version.py +++ b/src/cribl_mgmt_plane/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "cribl-mgmt-plane" -__version__: str = "0.5.1" +__version__: str = "0.5.2" __openapi_doc_version__: str = "1.0" __gen_version__: str = "2.932.9" -__user_agent__: str = "speakeasy-sdk/python 0.5.1 2.932.9 1.0 cribl-mgmt-plane" +__user_agent__: str = "speakeasy-sdk/python 0.5.2 2.932.9 1.0 cribl-mgmt-plane" try: if __package__ is not None: diff --git a/src/cribl_mgmt_plane/billing.py b/src/cribl_mgmt_plane/billing.py new file mode 100644 index 0000000..ecbcd38 --- /dev/null +++ b/src/cribl_mgmt_plane/billing.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from .sdkconfiguration import SDKConfiguration +from cribl_mgmt_plane.credits import Credits +from typing import Optional + + +class Billing(BaseSDK): + credits: Credits + + def __init__( + self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None + ) -> None: + BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) + self.sdk_configuration = sdk_config + self._init_sdks() + + def _init_sdks(self): + self.credits = Credits(self.sdk_configuration, parent_ref=self.parent_ref) diff --git a/src/cribl_mgmt_plane/contractsutilization.py b/src/cribl_mgmt_plane/contractsutilization.py new file mode 100644 index 0000000..a719c76 --- /dev/null +++ b/src/cribl_mgmt_plane/contractsutilization.py @@ -0,0 +1,218 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from cribl_mgmt_plane import errors, models, utils +from cribl_mgmt_plane._hooks import HookContext +from cribl_mgmt_plane.types import OptionalNullable, UNSET +from cribl_mgmt_plane.utils import get_security_from_env +from cribl_mgmt_plane.utils.unmarshal_json_response import unmarshal_json_response +from datetime import datetime +from typing import Mapping, Optional + + +class ContractsUtilization(BaseSDK): + def list( + self, + *, + organization_id: str, + starting_on: datetime, + ending_before: datetime, + window: models.BillingWindow, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.V1BillingGetContractsUtilizationResponse: + r"""Get contract credit utilization + + Get cumulative credit utilization data grouped by contract period for the specified Organization. + + :param organization_id: The id of the Organization. + :param starting_on: Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. + :param ending_before: Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. + :param window: Aggregation granularity for credit utilization data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.V1BillingGetContractsUtilizationRequest( + organization_id=organization_id, + starting_on=starting_on, + ending_before=ending_before, + window=window, + ) + + req = self._build_request( + method="GET", + path="/v1/organizations/{organizationId}/billing/credits/contracts-utilization", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="v1.billing.getContractsUtilization", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["billing"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + models.ContractsUtilizationResponseDTO, http_res + ) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["503", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "default", "application/json"): + return unmarshal_json_response(models.DefaultErrorDTO, http_res) + + raise errors.APIError("Unexpected response received", http_res) + + async def list_async( + self, + *, + organization_id: str, + starting_on: datetime, + ending_before: datetime, + window: models.BillingWindow, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.V1BillingGetContractsUtilizationResponse: + r"""Get contract credit utilization + + Get cumulative credit utilization data grouped by contract period for the specified Organization. + + :param organization_id: The id of the Organization. + :param starting_on: Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. + :param ending_before: Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. + :param window: Aggregation granularity for credit utilization data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.V1BillingGetContractsUtilizationRequest( + organization_id=organization_id, + starting_on=starting_on, + ending_before=ending_before, + window=window, + ) + + req = self._build_request_async( + method="GET", + path="/v1/organizations/{organizationId}/billing/credits/contracts-utilization", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="v1.billing.getContractsUtilization", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["billing"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + models.ContractsUtilizationResponseDTO, http_res + ) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["503", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "default", "application/json"): + return unmarshal_json_response(models.DefaultErrorDTO, http_res) + + raise errors.APIError("Unexpected response received", http_res) diff --git a/src/cribl_mgmt_plane/credits.py b/src/cribl_mgmt_plane/credits.py new file mode 100644 index 0000000..200e446 --- /dev/null +++ b/src/cribl_mgmt_plane/credits.py @@ -0,0 +1,31 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from .sdkconfiguration import SDKConfiguration +from cribl_mgmt_plane.contractsutilization import ContractsUtilization +from cribl_mgmt_plane.grants import Grants +from cribl_mgmt_plane.stats import Stats +from cribl_mgmt_plane.timeseries import Timeseries +from typing import Optional + + +class Credits(BaseSDK): + contracts_utilization: ContractsUtilization + timeseries: Timeseries + stats: Stats + grants: Grants + + def __init__( + self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None + ) -> None: + BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) + self.sdk_configuration = sdk_config + self._init_sdks() + + def _init_sdks(self): + self.contracts_utilization = ContractsUtilization( + self.sdk_configuration, parent_ref=self.parent_ref + ) + self.timeseries = Timeseries(self.sdk_configuration, parent_ref=self.parent_ref) + self.stats = Stats(self.sdk_configuration, parent_ref=self.parent_ref) + self.grants = Grants(self.sdk_configuration, parent_ref=self.parent_ref) diff --git a/src/cribl_mgmt_plane/grants.py b/src/cribl_mgmt_plane/grants.py new file mode 100644 index 0000000..8e287d9 --- /dev/null +++ b/src/cribl_mgmt_plane/grants.py @@ -0,0 +1,208 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from cribl_mgmt_plane import errors, models, utils +from cribl_mgmt_plane._hooks import HookContext +from cribl_mgmt_plane.types import OptionalNullable, UNSET +from cribl_mgmt_plane.utils import get_security_from_env +from cribl_mgmt_plane.utils.unmarshal_json_response import unmarshal_json_response +from datetime import datetime +from typing import Mapping, Optional + + +class Grants(BaseSDK): + def list( + self, + *, + organization_id: str, + starting_on: datetime, + ending_before: datetime, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.V1BillingGetCreditsGrantsResponse: + r"""Get credit grants + + Get credit grants (purchases, rollovers, and refunds) for the specified Organization. + + :param organization_id: The id of the Organization. + :param starting_on: Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years. + :param ending_before: Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.V1BillingGetCreditsGrantsRequest( + organization_id=organization_id, + starting_on=starting_on, + ending_before=ending_before, + ) + + req = self._build_request( + method="GET", + path="/v1/organizations/{organizationId}/billing/credits/grants", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="v1.billing.getCreditsGrants", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["billing"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreditGrantsResponseDTO, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["503", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "default", "application/json"): + return unmarshal_json_response(models.DefaultErrorDTO, http_res) + + raise errors.APIError("Unexpected response received", http_res) + + async def list_async( + self, + *, + organization_id: str, + starting_on: datetime, + ending_before: datetime, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.V1BillingGetCreditsGrantsResponse: + r"""Get credit grants + + Get credit grants (purchases, rollovers, and refunds) for the specified Organization. + + :param organization_id: The id of the Organization. + :param starting_on: Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years. + :param ending_before: Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.V1BillingGetCreditsGrantsRequest( + organization_id=organization_id, + starting_on=starting_on, + ending_before=ending_before, + ) + + req = self._build_request_async( + method="GET", + path="/v1/organizations/{organizationId}/billing/credits/grants", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="v1.billing.getCreditsGrants", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["billing"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreditGrantsResponseDTO, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["503", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "default", "application/json"): + return unmarshal_json_response(models.DefaultErrorDTO, http_res) + + raise errors.APIError("Unexpected response received", http_res) diff --git a/src/cribl_mgmt_plane/models/__init__.py b/src/cribl_mgmt_plane/models/__init__.py index e1224e6..7bae479 100644 --- a/src/cribl_mgmt_plane/models/__init__.py +++ b/src/cribl_mgmt_plane/models/__init__.py @@ -30,6 +30,44 @@ APICredentialUpdateRequestDTO, APICredentialUpdateRequestDTOTypedDict, ) + from .billingwindow import BillingWindow + from .contractsutilizationresponsedto import ( + ContractsUtilizationResponseDTO, + ContractsUtilizationResponseDTOTypedDict, + ) + from .contractutilizationschema import ( + ContractUtilizationSchema, + ContractUtilizationSchemaTypedDict, + ) + from .creditgrantschema import CreditGrantSchema, CreditGrantSchemaTypedDict, Type + from .creditgrantsresponsedto import ( + CreditGrantsResponseDTO, + CreditGrantsResponseDTOTypedDict, + ) + from .creditsstatscontractschema import ( + CreditsStatsContractSchema, + CreditsStatsContractSchemaTypedDict, + ) + from .creditsstatsresponsedto import ( + CreditsStatsResponseDTO, + CreditsStatsResponseDTOTypedDict, + ) + from .creditstimeseriesdimensionschema import ( + CreditsTimeseriesDimensionSchema, + CreditsTimeseriesDimensionSchemaTypedDict, + ) + from .creditstimeseriesitemschema import ( + CreditsTimeseriesItemSchema, + CreditsTimeseriesItemSchemaTypedDict, + ) + from .creditstimeseriesresponsedto import ( + CreditsTimeseriesResponseDTO, + CreditsTimeseriesResponseDTOTypedDict, + ) + from .creditsutilizationitemschema import ( + CreditsUtilizationItemSchema, + CreditsUtilizationItemSchemaTypedDict, + ) from .defaulterrordto import DefaultErrorDTO, DefaultErrorDTOTypedDict from .gethealthstatusop import ( GetHealthStatusResponse, @@ -71,6 +109,30 @@ V1APICredentialsUpdateAPICredentialRequest, V1APICredentialsUpdateAPICredentialRequestTypedDict, ) + from .v1_billing_getcontractsutilizationop import ( + V1BillingGetContractsUtilizationRequest, + V1BillingGetContractsUtilizationRequestTypedDict, + V1BillingGetContractsUtilizationResponse, + V1BillingGetContractsUtilizationResponseTypedDict, + ) + from .v1_billing_getcreditsgrantsop import ( + V1BillingGetCreditsGrantsRequest, + V1BillingGetCreditsGrantsRequestTypedDict, + V1BillingGetCreditsGrantsResponse, + V1BillingGetCreditsGrantsResponseTypedDict, + ) + from .v1_billing_getcreditsstatsop import ( + V1BillingGetCreditsStatsRequest, + V1BillingGetCreditsStatsRequestTypedDict, + V1BillingGetCreditsStatsResponse, + V1BillingGetCreditsStatsResponseTypedDict, + ) + from .v1_billing_getcreditstimeseriesop import ( + V1BillingGetCreditsTimeseriesRequest, + V1BillingGetCreditsTimeseriesRequestTypedDict, + V1BillingGetCreditsTimeseriesResponse, + V1BillingGetCreditsTimeseriesResponseTypedDict, + ) from .v1_workspaces_createworkspaceop import ( V1WorkspacesCreateWorkspaceRequest, V1WorkspacesCreateWorkspaceRequestTypedDict, @@ -134,6 +196,27 @@ "APICredentialUpdateRequestDTOTypedDict", "APICredentialsListResponseDTO", "APICredentialsListResponseDTOTypedDict", + "BillingWindow", + "ContractUtilizationSchema", + "ContractUtilizationSchemaTypedDict", + "ContractsUtilizationResponseDTO", + "ContractsUtilizationResponseDTOTypedDict", + "CreditGrantSchema", + "CreditGrantSchemaTypedDict", + "CreditGrantsResponseDTO", + "CreditGrantsResponseDTOTypedDict", + "CreditsStatsContractSchema", + "CreditsStatsContractSchemaTypedDict", + "CreditsStatsResponseDTO", + "CreditsStatsResponseDTOTypedDict", + "CreditsTimeseriesDimensionSchema", + "CreditsTimeseriesDimensionSchemaTypedDict", + "CreditsTimeseriesItemSchema", + "CreditsTimeseriesItemSchemaTypedDict", + "CreditsTimeseriesResponseDTO", + "CreditsTimeseriesResponseDTOTypedDict", + "CreditsUtilizationItemSchema", + "CreditsUtilizationItemSchemaTypedDict", "DefaultErrorDTO", "DefaultErrorDTOTypedDict", "GetHealthStatusResponse", @@ -151,6 +234,7 @@ "Security", "SecurityTypedDict", "State", + "Type", "V1APICredentialsCreateAPICredentialRequest", "V1APICredentialsCreateAPICredentialRequestTypedDict", "V1APICredentialsCreateAPICredentialResponse", @@ -167,6 +251,22 @@ "V1APICredentialsListAPICredentialsResponseTypedDict", "V1APICredentialsUpdateAPICredentialRequest", "V1APICredentialsUpdateAPICredentialRequestTypedDict", + "V1BillingGetContractsUtilizationRequest", + "V1BillingGetContractsUtilizationRequestTypedDict", + "V1BillingGetContractsUtilizationResponse", + "V1BillingGetContractsUtilizationResponseTypedDict", + "V1BillingGetCreditsGrantsRequest", + "V1BillingGetCreditsGrantsRequestTypedDict", + "V1BillingGetCreditsGrantsResponse", + "V1BillingGetCreditsGrantsResponseTypedDict", + "V1BillingGetCreditsStatsRequest", + "V1BillingGetCreditsStatsRequestTypedDict", + "V1BillingGetCreditsStatsResponse", + "V1BillingGetCreditsStatsResponseTypedDict", + "V1BillingGetCreditsTimeseriesRequest", + "V1BillingGetCreditsTimeseriesRequestTypedDict", + "V1BillingGetCreditsTimeseriesResponse", + "V1BillingGetCreditsTimeseriesResponseTypedDict", "V1WorkspacesCreateWorkspaceRequest", "V1WorkspacesCreateWorkspaceRequestTypedDict", "V1WorkspacesCreateWorkspaceResponse", @@ -210,6 +310,28 @@ "APICredentialsListResponseDTOTypedDict": ".apicredentialslistresponsedto", "APICredentialUpdateRequestDTO": ".apicredentialupdaterequestdto", "APICredentialUpdateRequestDTOTypedDict": ".apicredentialupdaterequestdto", + "BillingWindow": ".billingwindow", + "ContractsUtilizationResponseDTO": ".contractsutilizationresponsedto", + "ContractsUtilizationResponseDTOTypedDict": ".contractsutilizationresponsedto", + "ContractUtilizationSchema": ".contractutilizationschema", + "ContractUtilizationSchemaTypedDict": ".contractutilizationschema", + "CreditGrantSchema": ".creditgrantschema", + "CreditGrantSchemaTypedDict": ".creditgrantschema", + "Type": ".creditgrantschema", + "CreditGrantsResponseDTO": ".creditgrantsresponsedto", + "CreditGrantsResponseDTOTypedDict": ".creditgrantsresponsedto", + "CreditsStatsContractSchema": ".creditsstatscontractschema", + "CreditsStatsContractSchemaTypedDict": ".creditsstatscontractschema", + "CreditsStatsResponseDTO": ".creditsstatsresponsedto", + "CreditsStatsResponseDTOTypedDict": ".creditsstatsresponsedto", + "CreditsTimeseriesDimensionSchema": ".creditstimeseriesdimensionschema", + "CreditsTimeseriesDimensionSchemaTypedDict": ".creditstimeseriesdimensionschema", + "CreditsTimeseriesItemSchema": ".creditstimeseriesitemschema", + "CreditsTimeseriesItemSchemaTypedDict": ".creditstimeseriesitemschema", + "CreditsTimeseriesResponseDTO": ".creditstimeseriesresponsedto", + "CreditsTimeseriesResponseDTOTypedDict": ".creditstimeseriesresponsedto", + "CreditsUtilizationItemSchema": ".creditsutilizationitemschema", + "CreditsUtilizationItemSchemaTypedDict": ".creditsutilizationitemschema", "DefaultErrorDTO": ".defaulterrordto", "DefaultErrorDTOTypedDict": ".defaulterrordto", "GetHealthStatusResponse": ".gethealthstatusop", @@ -240,6 +362,22 @@ "V1APICredentialsListAPICredentialsResponseTypedDict": ".v1_apicredentials_listapicredentialsop", "V1APICredentialsUpdateAPICredentialRequest": ".v1_apicredentials_updateapicredentialop", "V1APICredentialsUpdateAPICredentialRequestTypedDict": ".v1_apicredentials_updateapicredentialop", + "V1BillingGetContractsUtilizationRequest": ".v1_billing_getcontractsutilizationop", + "V1BillingGetContractsUtilizationRequestTypedDict": ".v1_billing_getcontractsutilizationop", + "V1BillingGetContractsUtilizationResponse": ".v1_billing_getcontractsutilizationop", + "V1BillingGetContractsUtilizationResponseTypedDict": ".v1_billing_getcontractsutilizationop", + "V1BillingGetCreditsGrantsRequest": ".v1_billing_getcreditsgrantsop", + "V1BillingGetCreditsGrantsRequestTypedDict": ".v1_billing_getcreditsgrantsop", + "V1BillingGetCreditsGrantsResponse": ".v1_billing_getcreditsgrantsop", + "V1BillingGetCreditsGrantsResponseTypedDict": ".v1_billing_getcreditsgrantsop", + "V1BillingGetCreditsStatsRequest": ".v1_billing_getcreditsstatsop", + "V1BillingGetCreditsStatsRequestTypedDict": ".v1_billing_getcreditsstatsop", + "V1BillingGetCreditsStatsResponse": ".v1_billing_getcreditsstatsop", + "V1BillingGetCreditsStatsResponseTypedDict": ".v1_billing_getcreditsstatsop", + "V1BillingGetCreditsTimeseriesRequest": ".v1_billing_getcreditstimeseriesop", + "V1BillingGetCreditsTimeseriesRequestTypedDict": ".v1_billing_getcreditstimeseriesop", + "V1BillingGetCreditsTimeseriesResponse": ".v1_billing_getcreditstimeseriesop", + "V1BillingGetCreditsTimeseriesResponseTypedDict": ".v1_billing_getcreditstimeseriesop", "V1WorkspacesCreateWorkspaceRequest": ".v1_workspaces_createworkspaceop", "V1WorkspacesCreateWorkspaceRequestTypedDict": ".v1_workspaces_createworkspaceop", "V1WorkspacesCreateWorkspaceResponse": ".v1_workspaces_createworkspaceop", diff --git a/src/cribl_mgmt_plane/models/billingwindow.py b/src/cribl_mgmt_plane/models/billingwindow.py new file mode 100644 index 0000000..b3c1279 --- /dev/null +++ b/src/cribl_mgmt_plane/models/billingwindow.py @@ -0,0 +1,10 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from cribl_mgmt_plane import utils +from enum import Enum + + +class BillingWindow(str, Enum, metaclass=utils.OpenEnumMeta): + MONTHLY = "monthly" + DAILY = "daily" diff --git a/src/cribl_mgmt_plane/models/contractsutilizationresponsedto.py b/src/cribl_mgmt_plane/models/contractsutilizationresponsedto.py new file mode 100644 index 0000000..249ffc9 --- /dev/null +++ b/src/cribl_mgmt_plane/models/contractsutilizationresponsedto.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .contractutilizationschema import ( + ContractUtilizationSchema, + ContractUtilizationSchemaTypedDict, +) +from cribl_mgmt_plane.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class ContractsUtilizationResponseDTOTypedDict(TypedDict): + contracts: List[ContractUtilizationSchemaTypedDict] + r"""Contract utilization data, grouped by contract period.""" + + +class ContractsUtilizationResponseDTO(BaseModel): + contracts: List[ContractUtilizationSchema] + r"""Contract utilization data, grouped by contract period.""" diff --git a/src/cribl_mgmt_plane/models/contractutilizationschema.py b/src/cribl_mgmt_plane/models/contractutilizationschema.py new file mode 100644 index 0000000..ceff4e9 --- /dev/null +++ b/src/cribl_mgmt_plane/models/contractutilizationschema.py @@ -0,0 +1,57 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .creditsutilizationitemschema import ( + CreditsUtilizationItemSchema, + CreditsUtilizationItemSchemaTypedDict, +) +from cribl_mgmt_plane.types import BaseModel, UNSET_SENTINEL +from datetime import datetime +import pydantic +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ContractUtilizationSchemaTypedDict(TypedDict): + contract_start_date: datetime + r"""Contract start date in ISO 8601 format.""" + items: List[CreditsUtilizationItemSchemaTypedDict] + r"""Cumulative credit utilization entries for the contract.""" + contract_end_date: NotRequired[datetime] + r"""Contract end date in ISO 8601 format. Present only when the contract is closed.""" + + +class ContractUtilizationSchema(BaseModel): + contract_start_date: Annotated[datetime, pydantic.Field(alias="contractStartDate")] + r"""Contract start date in ISO 8601 format.""" + + items: List[CreditsUtilizationItemSchema] + r"""Cumulative credit utilization entries for the contract.""" + + contract_end_date: Annotated[ + Optional[datetime], pydantic.Field(alias="contractEndDate") + ] = None + r"""Contract end date in ISO 8601 format. Present only when the contract is closed.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["contractEndDate"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + ContractUtilizationSchema.model_rebuild() +except NameError: + pass diff --git a/src/cribl_mgmt_plane/models/creditgrantschema.py b/src/cribl_mgmt_plane/models/creditgrantschema.py new file mode 100644 index 0000000..6493679 --- /dev/null +++ b/src/cribl_mgmt_plane/models/creditgrantschema.py @@ -0,0 +1,53 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from cribl_mgmt_plane import models, utils +from cribl_mgmt_plane.types import BaseModel +from datetime import datetime +from enum import Enum +import pydantic +from pydantic import field_serializer +from typing_extensions import Annotated, TypedDict + + +class Type(str, Enum, metaclass=utils.OpenEnumMeta): + r"""Type of the credit grant.""" + + REFUND = "Refund" + ROLLOVER = "Rollover" + PURCHASED = "Purchased" + + +class CreditGrantSchemaTypedDict(TypedDict): + date_: datetime + r"""Date the grant was issued, in ISO 8601 format.""" + credits_acquired: float + r"""Number of credits acquired by the grant.""" + type: Type + r"""Type of the credit grant.""" + + +class CreditGrantSchema(BaseModel): + date_: Annotated[datetime, pydantic.Field(alias="date")] + r"""Date the grant was issued, in ISO 8601 format.""" + + credits_acquired: Annotated[float, pydantic.Field(alias="creditsAcquired")] + r"""Number of credits acquired by the grant.""" + + type: Type + r"""Type of the credit grant.""" + + @field_serializer("type") + def serialize_type(self, value): + if isinstance(value, str): + try: + return models.Type(value) + except ValueError: + return value + return value + + +try: + CreditGrantSchema.model_rebuild() +except NameError: + pass diff --git a/src/cribl_mgmt_plane/models/creditgrantsresponsedto.py b/src/cribl_mgmt_plane/models/creditgrantsresponsedto.py new file mode 100644 index 0000000..522842f --- /dev/null +++ b/src/cribl_mgmt_plane/models/creditgrantsresponsedto.py @@ -0,0 +1,22 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .creditgrantschema import CreditGrantSchema, CreditGrantSchemaTypedDict +from cribl_mgmt_plane.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class CreditGrantsResponseDTOTypedDict(TypedDict): + items: List[CreditGrantSchemaTypedDict] + r"""Credit grants for the queried period.""" + count: int + r"""Total number of items in the response.""" + + +class CreditGrantsResponseDTO(BaseModel): + items: List[CreditGrantSchema] + r"""Credit grants for the queried period.""" + + count: int + r"""Total number of items in the response.""" diff --git a/src/cribl_mgmt_plane/models/creditsstatscontractschema.py b/src/cribl_mgmt_plane/models/creditsstatscontractschema.py new file mode 100644 index 0000000..b379ee0 --- /dev/null +++ b/src/cribl_mgmt_plane/models/creditsstatscontractschema.py @@ -0,0 +1,46 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from cribl_mgmt_plane.types import BaseModel, UNSET_SENTINEL +from datetime import datetime +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreditsStatsContractSchemaTypedDict(TypedDict): + start_date: datetime + r"""Contract start date in ISO 8601 format.""" + end_date: NotRequired[datetime] + r"""Contract end date in ISO 8601 format. Present only when the contract is closed.""" + + +class CreditsStatsContractSchema(BaseModel): + start_date: Annotated[datetime, pydantic.Field(alias="startDate")] + r"""Contract start date in ISO 8601 format.""" + + end_date: Annotated[Optional[datetime], pydantic.Field(alias="endDate")] = None + r"""Contract end date in ISO 8601 format. Present only when the contract is closed.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["endDate"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + CreditsStatsContractSchema.model_rebuild() +except NameError: + pass diff --git a/src/cribl_mgmt_plane/models/creditsstatsresponsedto.py b/src/cribl_mgmt_plane/models/creditsstatsresponsedto.py new file mode 100644 index 0000000..0ea4761 --- /dev/null +++ b/src/cribl_mgmt_plane/models/creditsstatsresponsedto.py @@ -0,0 +1,63 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .creditsstatscontractschema import ( + CreditsStatsContractSchema, + CreditsStatsContractSchemaTypedDict, +) +from cribl_mgmt_plane.types import BaseModel, UNSET_SENTINEL +import pydantic +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreditsStatsResponseDTOTypedDict(TypedDict): + total_credits_remaining: float + r"""Total credits remaining across all contracts.""" + total_credits_used: float + r"""Total credits consumed across all contracts.""" + total_credits_acquired: float + r"""Total credits acquired across all contracts.""" + contracts: NotRequired[List[CreditsStatsContractSchemaTypedDict]] + r"""Contract periods ordered by contract start date in reverse chronological order (newest first).""" + + +class CreditsStatsResponseDTO(BaseModel): + total_credits_remaining: Annotated[ + float, pydantic.Field(alias="totalCreditsRemaining") + ] + r"""Total credits remaining across all contracts.""" + + total_credits_used: Annotated[float, pydantic.Field(alias="totalCreditsUsed")] + r"""Total credits consumed across all contracts.""" + + total_credits_acquired: Annotated[ + float, pydantic.Field(alias="totalCreditsAcquired") + ] + r"""Total credits acquired across all contracts.""" + + contracts: Optional[List[CreditsStatsContractSchema]] = None + r"""Contract periods ordered by contract start date in reverse chronological order (newest first).""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["contracts"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + CreditsStatsResponseDTO.model_rebuild() +except NameError: + pass diff --git a/src/cribl_mgmt_plane/models/creditstimeseriesdimensionschema.py b/src/cribl_mgmt_plane/models/creditstimeseriesdimensionschema.py new file mode 100644 index 0000000..905dbf2 --- /dev/null +++ b/src/cribl_mgmt_plane/models/creditstimeseriesdimensionschema.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from cribl_mgmt_plane.types import BaseModel +from typing_extensions import TypedDict + + +class CreditsTimeseriesDimensionSchemaTypedDict(TypedDict): + dimension: str + r"""Dimension label for the credit breakdown.""" + credits: float + r"""Number of credits attributed to the dimension.""" + + +class CreditsTimeseriesDimensionSchema(BaseModel): + dimension: str + r"""Dimension label for the credit breakdown.""" + + credits: float + r"""Number of credits attributed to the dimension.""" diff --git a/src/cribl_mgmt_plane/models/creditstimeseriesitemschema.py b/src/cribl_mgmt_plane/models/creditstimeseriesitemschema.py new file mode 100644 index 0000000..a0e12c8 --- /dev/null +++ b/src/cribl_mgmt_plane/models/creditstimeseriesitemschema.py @@ -0,0 +1,38 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .creditstimeseriesdimensionschema import ( + CreditsTimeseriesDimensionSchema, + CreditsTimeseriesDimensionSchemaTypedDict, +) +from cribl_mgmt_plane.types import BaseModel +from datetime import datetime +import pydantic +from typing import List +from typing_extensions import Annotated, TypedDict + + +class CreditsTimeseriesItemSchemaTypedDict(TypedDict): + date_: datetime + r"""Date of the aggregation window in ISO 8601 format.""" + credits: float + r"""Total credits consumed in the aggregation window.""" + dimensions: List[CreditsTimeseriesDimensionSchemaTypedDict] + r"""Credit breakdown by dimension.""" + + +class CreditsTimeseriesItemSchema(BaseModel): + date_: Annotated[datetime, pydantic.Field(alias="date")] + r"""Date of the aggregation window in ISO 8601 format.""" + + credits: float + r"""Total credits consumed in the aggregation window.""" + + dimensions: List[CreditsTimeseriesDimensionSchema] + r"""Credit breakdown by dimension.""" + + +try: + CreditsTimeseriesItemSchema.model_rebuild() +except NameError: + pass diff --git a/src/cribl_mgmt_plane/models/creditstimeseriesresponsedto.py b/src/cribl_mgmt_plane/models/creditstimeseriesresponsedto.py new file mode 100644 index 0000000..e3bbf05 --- /dev/null +++ b/src/cribl_mgmt_plane/models/creditstimeseriesresponsedto.py @@ -0,0 +1,25 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .creditstimeseriesitemschema import ( + CreditsTimeseriesItemSchema, + CreditsTimeseriesItemSchemaTypedDict, +) +from cribl_mgmt_plane.types import BaseModel +from typing import List +from typing_extensions import TypedDict + + +class CreditsTimeseriesResponseDTOTypedDict(TypedDict): + items: List[CreditsTimeseriesItemSchemaTypedDict] + r"""Credit timeseries data points.""" + count: int + r"""Total number of items in the response.""" + + +class CreditsTimeseriesResponseDTO(BaseModel): + items: List[CreditsTimeseriesItemSchema] + r"""Credit timeseries data points.""" + + count: int + r"""Total number of items in the response.""" diff --git a/src/cribl_mgmt_plane/models/creditsutilizationitemschema.py b/src/cribl_mgmt_plane/models/creditsutilizationitemschema.py new file mode 100644 index 0000000..1dc3bc7 --- /dev/null +++ b/src/cribl_mgmt_plane/models/creditsutilizationitemschema.py @@ -0,0 +1,28 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from cribl_mgmt_plane.types import BaseModel +from datetime import datetime +import pydantic +from typing_extensions import Annotated, TypedDict + + +class CreditsUtilizationItemSchemaTypedDict(TypedDict): + date_: datetime + r"""Date of the aggregation window in ISO 8601 format.""" + credits: float + r"""Number of credits consumed in the aggregation window.""" + + +class CreditsUtilizationItemSchema(BaseModel): + date_: Annotated[datetime, pydantic.Field(alias="date")] + r"""Date of the aggregation window in ISO 8601 format.""" + + credits: float + r"""Number of credits consumed in the aggregation window.""" + + +try: + CreditsUtilizationItemSchema.model_rebuild() +except NameError: + pass diff --git a/src/cribl_mgmt_plane/models/v1_billing_getcontractsutilizationop.py b/src/cribl_mgmt_plane/models/v1_billing_getcontractsutilizationop.py new file mode 100644 index 0000000..e3f4bc4 --- /dev/null +++ b/src/cribl_mgmt_plane/models/v1_billing_getcontractsutilizationop.py @@ -0,0 +1,78 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .billingwindow import BillingWindow +from .contractsutilizationresponsedto import ( + ContractsUtilizationResponseDTO, + ContractsUtilizationResponseDTOTypedDict, +) +from .defaulterrordto import DefaultErrorDTO, DefaultErrorDTOTypedDict +from cribl_mgmt_plane import models +from cribl_mgmt_plane.types import BaseModel +from cribl_mgmt_plane.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata +from datetime import datetime +import pydantic +from pydantic import field_serializer +from typing import Union +from typing_extensions import Annotated, TypeAliasType, TypedDict + + +class V1BillingGetContractsUtilizationRequestTypedDict(TypedDict): + organization_id: str + r"""The id of the Organization.""" + starting_on: datetime + r"""Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly.""" + ending_before: datetime + r"""Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly.""" + window: BillingWindow + r"""Aggregation granularity for credit utilization data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly.""" + + +class V1BillingGetContractsUtilizationRequest(BaseModel): + organization_id: Annotated[ + str, + pydantic.Field(alias="organizationId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""The id of the Organization.""" + + starting_on: Annotated[ + datetime, + pydantic.Field(alias="startingOn"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly.""" + + ending_before: Annotated[ + datetime, + pydantic.Field(alias="endingBefore"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly.""" + + window: Annotated[ + BillingWindow, + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Aggregation granularity for credit utilization data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly.""" + + @field_serializer("window") + def serialize_window(self, value): + if isinstance(value, str): + try: + return models.BillingWindow(value) + except ValueError: + return value + return value + + +V1BillingGetContractsUtilizationResponseTypedDict = TypeAliasType( + "V1BillingGetContractsUtilizationResponseTypedDict", + Union[ContractsUtilizationResponseDTOTypedDict, DefaultErrorDTOTypedDict], +) + + +V1BillingGetContractsUtilizationResponse = TypeAliasType( + "V1BillingGetContractsUtilizationResponse", + Union[ContractsUtilizationResponseDTO, DefaultErrorDTO], +) diff --git a/src/cribl_mgmt_plane/models/v1_billing_getcreditsgrantsop.py b/src/cribl_mgmt_plane/models/v1_billing_getcreditsgrantsop.py new file mode 100644 index 0000000..22252d4 --- /dev/null +++ b/src/cribl_mgmt_plane/models/v1_billing_getcreditsgrantsop.py @@ -0,0 +1,57 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .creditgrantsresponsedto import ( + CreditGrantsResponseDTO, + CreditGrantsResponseDTOTypedDict, +) +from .defaulterrordto import DefaultErrorDTO, DefaultErrorDTOTypedDict +from cribl_mgmt_plane.types import BaseModel +from cribl_mgmt_plane.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata +from datetime import datetime +import pydantic +from typing import Union +from typing_extensions import Annotated, TypeAliasType, TypedDict + + +class V1BillingGetCreditsGrantsRequestTypedDict(TypedDict): + organization_id: str + r"""The id of the Organization.""" + starting_on: datetime + r"""Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years.""" + ending_before: datetime + r"""Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years.""" + + +class V1BillingGetCreditsGrantsRequest(BaseModel): + organization_id: Annotated[ + str, + pydantic.Field(alias="organizationId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""The id of the Organization.""" + + starting_on: Annotated[ + datetime, + pydantic.Field(alias="startingOn"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years.""" + + ending_before: Annotated[ + datetime, + pydantic.Field(alias="endingBefore"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years.""" + + +V1BillingGetCreditsGrantsResponseTypedDict = TypeAliasType( + "V1BillingGetCreditsGrantsResponseTypedDict", + Union[CreditGrantsResponseDTOTypedDict, DefaultErrorDTOTypedDict], +) + + +V1BillingGetCreditsGrantsResponse = TypeAliasType( + "V1BillingGetCreditsGrantsResponse", Union[CreditGrantsResponseDTO, DefaultErrorDTO] +) diff --git a/src/cribl_mgmt_plane/models/v1_billing_getcreditsstatsop.py b/src/cribl_mgmt_plane/models/v1_billing_getcreditsstatsop.py new file mode 100644 index 0000000..aff3d31 --- /dev/null +++ b/src/cribl_mgmt_plane/models/v1_billing_getcreditsstatsop.py @@ -0,0 +1,57 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .creditsstatsresponsedto import ( + CreditsStatsResponseDTO, + CreditsStatsResponseDTOTypedDict, +) +from .defaulterrordto import DefaultErrorDTO, DefaultErrorDTOTypedDict +from cribl_mgmt_plane.types import BaseModel +from cribl_mgmt_plane.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata +from datetime import datetime +import pydantic +from typing import Union +from typing_extensions import Annotated, TypeAliasType, TypedDict + + +class V1BillingGetCreditsStatsRequestTypedDict(TypedDict): + organization_id: str + r"""The id of the Organization.""" + starting_on: datetime + r"""Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years.""" + ending_before: datetime + r"""Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years.""" + + +class V1BillingGetCreditsStatsRequest(BaseModel): + organization_id: Annotated[ + str, + pydantic.Field(alias="organizationId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""The id of the Organization.""" + + starting_on: Annotated[ + datetime, + pydantic.Field(alias="startingOn"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years.""" + + ending_before: Annotated[ + datetime, + pydantic.Field(alias="endingBefore"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years.""" + + +V1BillingGetCreditsStatsResponseTypedDict = TypeAliasType( + "V1BillingGetCreditsStatsResponseTypedDict", + Union[DefaultErrorDTOTypedDict, CreditsStatsResponseDTOTypedDict], +) + + +V1BillingGetCreditsStatsResponse = TypeAliasType( + "V1BillingGetCreditsStatsResponse", Union[DefaultErrorDTO, CreditsStatsResponseDTO] +) diff --git a/src/cribl_mgmt_plane/models/v1_billing_getcreditstimeseriesop.py b/src/cribl_mgmt_plane/models/v1_billing_getcreditstimeseriesop.py new file mode 100644 index 0000000..af653eb --- /dev/null +++ b/src/cribl_mgmt_plane/models/v1_billing_getcreditstimeseriesop.py @@ -0,0 +1,78 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .billingwindow import BillingWindow +from .creditstimeseriesresponsedto import ( + CreditsTimeseriesResponseDTO, + CreditsTimeseriesResponseDTOTypedDict, +) +from .defaulterrordto import DefaultErrorDTO, DefaultErrorDTOTypedDict +from cribl_mgmt_plane import models +from cribl_mgmt_plane.types import BaseModel +from cribl_mgmt_plane.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata +from datetime import datetime +import pydantic +from pydantic import field_serializer +from typing import Union +from typing_extensions import Annotated, TypeAliasType, TypedDict + + +class V1BillingGetCreditsTimeseriesRequestTypedDict(TypedDict): + organization_id: str + r"""The id of the Organization.""" + starting_on: datetime + r"""Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly.""" + ending_before: datetime + r"""Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly.""" + window: BillingWindow + r"""Aggregation granularity for timeseries data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly.""" + + +class V1BillingGetCreditsTimeseriesRequest(BaseModel): + organization_id: Annotated[ + str, + pydantic.Field(alias="organizationId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""The id of the Organization.""" + + starting_on: Annotated[ + datetime, + pydantic.Field(alias="startingOn"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly.""" + + ending_before: Annotated[ + datetime, + pydantic.Field(alias="endingBefore"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly.""" + + window: Annotated[ + BillingWindow, + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + r"""Aggregation granularity for timeseries data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly.""" + + @field_serializer("window") + def serialize_window(self, value): + if isinstance(value, str): + try: + return models.BillingWindow(value) + except ValueError: + return value + return value + + +V1BillingGetCreditsTimeseriesResponseTypedDict = TypeAliasType( + "V1BillingGetCreditsTimeseriesResponseTypedDict", + Union[CreditsTimeseriesResponseDTOTypedDict, DefaultErrorDTOTypedDict], +) + + +V1BillingGetCreditsTimeseriesResponse = TypeAliasType( + "V1BillingGetCreditsTimeseriesResponse", + Union[CreditsTimeseriesResponseDTO, DefaultErrorDTO], +) diff --git a/src/cribl_mgmt_plane/sdk.py b/src/cribl_mgmt_plane/sdk.py index 4482439..5de5c7d 100644 --- a/src/cribl_mgmt_plane/sdk.py +++ b/src/cribl_mgmt_plane/sdk.py @@ -16,6 +16,7 @@ if TYPE_CHECKING: from cribl_mgmt_plane.apicredentials import APICredentials + from cribl_mgmt_plane.billing import Billing from cribl_mgmt_plane.health import Health from cribl_mgmt_plane.workspaces import Workspaces @@ -27,11 +28,13 @@ class CriblMgmtPlane(BaseSDK): r"""Operations related to application health status""" api_credentials: "APICredentials" r"""Operations related to API credentials""" + billing: "Billing" workspaces: "Workspaces" r"""Operations related to Workspaces""" _sub_sdk_map = { "health": ("cribl_mgmt_plane.health", "Health"), "api_credentials": ("cribl_mgmt_plane.apicredentials", "APICredentials"), + "billing": ("cribl_mgmt_plane.billing", "Billing"), "workspaces": ("cribl_mgmt_plane.workspaces", "Workspaces"), } diff --git a/src/cribl_mgmt_plane/stats.py b/src/cribl_mgmt_plane/stats.py new file mode 100644 index 0000000..4e24e16 --- /dev/null +++ b/src/cribl_mgmt_plane/stats.py @@ -0,0 +1,208 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from cribl_mgmt_plane import errors, models, utils +from cribl_mgmt_plane._hooks import HookContext +from cribl_mgmt_plane.types import OptionalNullable, UNSET +from cribl_mgmt_plane.utils import get_security_from_env +from cribl_mgmt_plane.utils.unmarshal_json_response import unmarshal_json_response +from datetime import datetime +from typing import Mapping, Optional + + +class Stats(BaseSDK): + def list( + self, + *, + organization_id: str, + starting_on: datetime, + ending_before: datetime, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.V1BillingGetCreditsStatsResponse: + r"""Get credit balance and consumption + + Get credit balance totals, consumption totals, and contract date ranges for the specified Organization. + + :param organization_id: The id of the Organization. + :param starting_on: Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years. + :param ending_before: Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.V1BillingGetCreditsStatsRequest( + organization_id=organization_id, + starting_on=starting_on, + ending_before=ending_before, + ) + + req = self._build_request( + method="GET", + path="/v1/organizations/{organizationId}/billing/credits/stats", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="v1.billing.getCreditsStats", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["billing"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreditsStatsResponseDTO, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["503", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "default", "application/json"): + return unmarshal_json_response(models.DefaultErrorDTO, http_res) + + raise errors.APIError("Unexpected response received", http_res) + + async def list_async( + self, + *, + organization_id: str, + starting_on: datetime, + ending_before: datetime, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.V1BillingGetCreditsStatsResponse: + r"""Get credit balance and consumption + + Get credit balance totals, consumption totals, and contract date ranges for the specified Organization. + + :param organization_id: The id of the Organization. + :param starting_on: Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range is 7 years. + :param ending_before: Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range is 7 years. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.V1BillingGetCreditsStatsRequest( + organization_id=organization_id, + starting_on=starting_on, + ending_before=ending_before, + ) + + req = self._build_request_async( + method="GET", + path="/v1/organizations/{organizationId}/billing/credits/stats", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="v1.billing.getCreditsStats", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["billing"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreditsStatsResponseDTO, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["503", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "default", "application/json"): + return unmarshal_json_response(models.DefaultErrorDTO, http_res) + + raise errors.APIError("Unexpected response received", http_res) diff --git a/src/cribl_mgmt_plane/timeseries.py b/src/cribl_mgmt_plane/timeseries.py new file mode 100644 index 0000000..417f123 --- /dev/null +++ b/src/cribl_mgmt_plane/timeseries.py @@ -0,0 +1,218 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from cribl_mgmt_plane import errors, models, utils +from cribl_mgmt_plane._hooks import HookContext +from cribl_mgmt_plane.types import OptionalNullable, UNSET +from cribl_mgmt_plane.utils import get_security_from_env +from cribl_mgmt_plane.utils.unmarshal_json_response import unmarshal_json_response +from datetime import datetime +from typing import Mapping, Optional + + +class Timeseries(BaseSDK): + def list( + self, + *, + organization_id: str, + starting_on: datetime, + ending_before: datetime, + window: models.BillingWindow, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.V1BillingGetCreditsTimeseriesResponse: + r"""Get credits timeseries + + Get credit consumption timeseries data for the specified Organization, broken down by dimensions such as product and usage type. + + :param organization_id: The id of the Organization. + :param starting_on: Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. + :param ending_before: Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. + :param window: Aggregation granularity for timeseries data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.V1BillingGetCreditsTimeseriesRequest( + organization_id=organization_id, + starting_on=starting_on, + ending_before=ending_before, + window=window, + ) + + req = self._build_request( + method="GET", + path="/v1/organizations/{organizationId}/billing/credits/timeseries", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="v1.billing.getCreditsTimeseries", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["billing"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + models.CreditsTimeseriesResponseDTO, http_res + ) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["503", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "default", "application/json"): + return unmarshal_json_response(models.DefaultErrorDTO, http_res) + + raise errors.APIError("Unexpected response received", http_res) + + async def list_async( + self, + *, + organization_id: str, + starting_on: datetime, + ending_before: datetime, + window: models.BillingWindow, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.V1BillingGetCreditsTimeseriesResponse: + r"""Get credits timeseries + + Get credit consumption timeseries data for the specified Organization, broken down by dimensions such as product and usage type. + + :param organization_id: The id of the Organization. + :param starting_on: Inclusive start of the query date range in ISO 8601 format. Must be before endingBefore. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. + :param ending_before: Exclusive end of the query date range in ISO 8601 format. Must be after startingOn. Minimum range is 1 day. Maximum range depends on window: 6 months for daily, 7 years for monthly. + :param window: Aggregation granularity for timeseries data. Determines the maximum allowed date range: up to 6 months for daily, up to 7 years for monthly. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.V1BillingGetCreditsTimeseriesRequest( + organization_id=organization_id, + starting_on=starting_on, + ending_before=ending_before, + window=window, + ) + + req = self._build_request_async( + method="GET", + path="/v1/organizations/{organizationId}/billing/credits/timeseries", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="v1.billing.getCreditsTimeseries", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["billing"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response( + models.CreditsTimeseriesResponseDTO, http_res + ) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, ["503", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.APIError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "default", "application/json"): + return unmarshal_json_response(models.DefaultErrorDTO, http_res) + + raise errors.APIError("Unexpected response received", http_res)