diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 39dc3e2..1030733 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,23 +1,23 @@ lockVersion: 2.0.0 id: 897b2045-55e2-49ca-a37b-2daf10d4e6ea management: - docChecksum: ff02bf1e8c144fe95e7799aea0b1be3c + docChecksum: e6e0c10664e32e305c7b92cf5b08f8be docVersion: "1.0" - speakeasyVersion: 1.790.3 - generationVersion: 2.918.4 - releaseVersion: 0.4.0 - configChecksum: 9f6d12a6cb2cde14d7e1a9633326a251 + speakeasyVersion: 1.793.1 + generationVersion: 2.928.0 + releaseVersion: 0.4.1 + configChecksum: 09e92fcdfa7e61ffee2f220255190175 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: 59c86bea-51aa-4897-b765-3e2af6d24759 - pristine_commit_hash: e4b11ccb5011daf00f77ad3a66919fb72294116b - pristine_tree_hash: f9f5c3a414e780dfb018386ff748efb804a6ea4d + generation_id: dd7bc106-63ee-4075-a0ea-2bfbe07b0a84 + pristine_commit_hash: 671fbfcdc4221c610ee0393a306206fe4ae8cf70 + pristine_tree_hash: b95b8b9930bc606f0ba0382b3b68e5bc35fcbfb8 features: python: additionalDependencies: 1.1.0 - core: 6.0.34 + core: 6.0.35 defaultEnabledRetries: 0.2.0 devContainers: 3.0.0 enumUnions: 0.1.1 @@ -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:a5453ad84838f565c76c74dbf3ac25b77b6106fc + pristine_git_object: 0a2c8c27ee4d88fafe81a2484ac2e913df9f795e + 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:d2820fa27599c15030ee09c00aa6e21c59eab72c + pristine_git_object: d07d587ee5c3b286f6ba05278540003aa19cfcf5 + 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 @@ -106,8 +150,8 @@ trackedFiles: pristine_git_object: a4886fefe1c5169da6561abde34b4849eb323ca4 docs/models/product.md: id: c91436bbe13a - last_write_checksum: sha1:6e30dbc5e1039740113430bfe3e9d35f7bce10bf - pristine_git_object: 55e3863ae7faeccffc5a45c62df55304b28fe97c + last_write_checksum: sha1:c7e1f67231481691208aab0f00a23ad1e2a1f74d + pristine_git_object: 58ada7e3069307d112964bd63a7f23368db5ce15 docs/models/productroleschema.md: id: 38abbf7af6b1 last_write_checksum: sha1:2db58f983775333af362f740d602d6bd30c64d1e @@ -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,6 +308,10 @@ trackedFiles: id: 93fa0592990c last_write_checksum: sha1:cf711100d968364bdb4f351b6476179b3e139b1b pristine_git_object: e3062d8822ef2c6a2103d9d7162eab6371b77104 + docs/sdks/billing/README.md: + id: dc915331dd9d + last_write_checksum: sha1:a22c8c8ca61ce99f876c3b7e1a1be1f542a48b58 + pristine_git_object: 3b615aee5b16bdd171e853f85d34b68243bcc036 docs/sdks/health/README.md: id: 5082c50d5e82 last_write_checksum: sha1:b56f83a1ea293ad9b5fd76797122e09dccdbc1f9 @@ -250,8 +334,8 @@ trackedFiles: pristine_git_object: fde5e0418e98324b2b3b2a8e02559e575b2f6cfa pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:4ba9858e221e1db13f1e061708c802ffdd8e074c - pristine_git_object: 105d87499423c0bece9467c8a384b64faf0396ed + last_write_checksum: sha1:1f55ee4042496fe7a2ee9dbd70ffab9768d81255 + pristine_git_object: 09785a90bd7e5124c0e438db4cfaea519c37f4da scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:24bfcb3bc609310d0b86cb75ca844b42d4c9c248 @@ -282,8 +366,8 @@ trackedFiles: pristine_git_object: c4dbfc9dc2f712029811f523ecfa50bebebb13fc src/cribl_mgmt_plane/_version.py: id: 8ec199fcd31a - last_write_checksum: sha1:9fe734a713c4e7172283349501a7030b2ff9bc50 - pristine_git_object: cd3491b2d64738e8b38e70c13543aa9524479c81 + last_write_checksum: sha1:45e5c09386b0b0a9a3782ed0cc8547ec47e83ae3 + pristine_git_object: f18a5ee1e01edb72c4863afe381c016a02c69b9b src/cribl_mgmt_plane/apicredentials.py: id: d344dfa0de1f last_write_checksum: sha1:ba1681e1e3515d0fcdfe1b49e24c47f6eb2b6058 @@ -292,6 +376,10 @@ trackedFiles: id: 024a102b240a last_write_checksum: sha1:81612e29f97ca18085e9c029df956289aabbad29 pristine_git_object: a062bb974e91d9389cbedfdbd53df1f7e1f5a6d0 + src/cribl_mgmt_plane/billing.py: + id: 1bbea1aca796 + last_write_checksum: sha1:1ffed1bfc2a51d879388f1a65731a5a8d3e9f5e3 + pristine_git_object: 8c95ab3c1ef53e531f9dec424da5b80524b992a6 src/cribl_mgmt_plane/errors/__init__.py: id: 53763ce236b6 last_write_checksum: sha1:959bb14a8cad993c700d93bec2ee8ce68833270c @@ -326,8 +414,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 +440,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:eda66b7621322345990615e505efcb2f58a5eec1 + pristine_git_object: 3240233dc87537420286a0959a5c5cb41466dff7 + 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:f04d5e83e30f7af75116db51abc30c64cbf047dc + pristine_git_object: 27659e1ffebef6db2a2bba1dd5d5f80ceb3137ce + 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 @@ -362,8 +494,8 @@ trackedFiles: pristine_git_object: 535a5ee57d35197513688f8e9ef04074b4bf2a09 src/cribl_mgmt_plane/models/productroleschema.py: id: 248b5fc5d37e - last_write_checksum: sha1:0f31f589c6a96f55c2e2fd39340b7f34677ce551 - pristine_git_object: e1b2262bf15625accae3ad852fc18eebc415327c + last_write_checksum: sha1:1da1d6d39e57d615855e7884a37fe5dcbe45b7fd + pristine_git_object: cbb45ca40ac0e2588512fa836056269312ae8c50 src/cribl_mgmt_plane/models/schemeclientoauth.py: id: f12e60add63a last_write_checksum: sha1:efd1cb34c025d16dde8f018f43e65cce0c9a2eea @@ -392,6 +524,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,8 +586,8 @@ 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:fde0bb3a24f454724b2665a62d0708e3c11bb081 + pristine_git_object: 93e68b877ed26b62ce530a21fba1534444fcfdd1 src/cribl_mgmt_plane/sdkconfiguration.py: id: 31a3f1e28307 last_write_checksum: sha1:008d083f213b1f7dacd0c7970dfd224e0c13c39c @@ -651,9 +799,64 @@ 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:\n* `cribl_mgmt_plane.billing.get_contracts_utilization()`: **Added**\n* `cribl_mgmt_plane.billing.get_credits_timeseries()`: **Added**\n* `cribl_mgmt_plane.billing.get_credits_stats()`: **Added**\n* `cribl_mgmt_plane.billing.get_credits_grants()`: **Added**\n* `cribl_mgmt_plane.api_credentials.list()`: `response.items[].roles.workspaces[].products[].product.enum(insights)` **Added**\n* `cribl_mgmt_plane.api_credentials.create()`: \n * `request.roles.workspaces[].products[].product.enum(insights)` **Added**\n * `response.roles.workspaces[].products[].product.enum(insights)` **Added**\n* `cribl_mgmt_plane.api_credentials.update()`: \n * `request.roles.workspaces[].products[].product.enum(insights)` **Added**\n* `cribl_mgmt_plane.api_credentials.get()`: `response.roles.workspaces[].products[].product.enum(insights)` **Added**\n" generatedFiles: - .devcontainer/README.md - .devcontainer/devcontainer.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index bc5866a..7c2005e 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -33,7 +33,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false python: - version: 0.4.0 + version: 0.4.1 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 66a7c61..cd0df65 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 + x-speakeasy-name-override: getContractsUtilization + /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 + x-speakeasy-name-override: getCreditsTimeseries + /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 + x-speakeasy-name-override: getCreditsStats + /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 + x-speakeasy-name-override: getCreditsGrants /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 @@ -434,6 +662,7 @@ components: - search - stream - lake + - insights description: Product name. x-speakeasy-unknown-values: allow ProductRole: @@ -726,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: number + 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: number + 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 a799a57..627132e 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.790.3 +speakeasyVersion: 1.793.1 sources: Cribl Cloud Management API: sourceNamespace: cribl-cloud-management-api - sourceRevisionDigest: sha256:c77143c6cb9382b2267881145e8d9d5fb9cbf56d913cefe254f03dbc74c7268b - sourceBlobDigest: sha256:32512a0b7eb4acffcb144a9e07fd8a594085173d114e19a807308a643222a105 + sourceRevisionDigest: sha256:26a3f00d879e71da68aa2f030e3773513cc9d04e0230ed83d75d32ac2b468283 + sourceBlobDigest: sha256:dcf20a3d2ccd968da5e52177fb41f3760cf019a5edfa9da72b0506b23d87443b tags: - latest - "1.0" @@ -11,13 +11,13 @@ targets: cribl-mgmt-plane: source: Cribl Cloud Management API sourceNamespace: cribl-cloud-management-api - sourceRevisionDigest: sha256:c77143c6cb9382b2267881145e8d9d5fb9cbf56d913cefe254f03dbc74c7268b - sourceBlobDigest: sha256:32512a0b7eb4acffcb144a9e07fd8a594085173d114e19a807308a643222a105 + sourceRevisionDigest: sha256:26a3f00d879e71da68aa2f030e3773513cc9d04e0230ed83d75d32ac2b468283 + sourceBlobDigest: sha256:dcf20a3d2ccd968da5e52177fb41f3760cf019a5edfa9da72b0506b23d87443b codeSamplesNamespace: cribl-cloud-management-api-python-code-samples - codeSamplesRevisionDigest: sha256:7ca3ddec5b2004440921f1ffb6bc66c7f0858950fad9a7f39b5186f508550f13 + codeSamplesRevisionDigest: sha256:24df285c0357552610d70d5d26af01a79f3e0c18b1b5d69faf66dcb46c66a340 workflow: workflowVersion: 1.0.0 - speakeasyVersion: 1.790.3 + speakeasyVersion: 1.793.1 sources: Cribl Cloud Management API: inputs: diff --git a/README-PYPI.md b/README-PYPI.md index 712559a..4728629 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -206,6 +206,13 @@ 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](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/billing/README.md) + +* [get_contracts_utilization](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/billing/README.md#get_contracts_utilization) - Get contract credit utilization +* [get_credits_timeseries](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/billing/README.md#get_credits_timeseries) - Get credits timeseries +* [get_credits_stats](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/billing/README.md#get_credits_stats) - Get credit balance and consumption +* [get_credits_grants](https://github.com/criblio/cribl_cloud_management_sdk_python/blob/master/docs/sdks/billing/README.md#get_credits_grants) - Get credit grants + ### [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 +370,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 2ce4451..c18044d 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,13 @@ 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](docs/sdks/billing/README.md) + +* [get_contracts_utilization](docs/sdks/billing/README.md#get_contracts_utilization) - Get contract credit utilization +* [get_credits_timeseries](docs/sdks/billing/README.md#get_credits_timeseries) - Get credits timeseries +* [get_credits_stats](docs/sdks/billing/README.md#get_credits_stats) - Get credit balance and consumption +* [get_credits_grants](docs/sdks/billing/README.md#get_credits_grants) - Get credit grants + ### [Health](docs/sdks/health/README.md) * [get](docs/sdks/health/README.md#get) - Get the health status of the application @@ -363,7 +370,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 1112871..df58862 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -368,4 +368,14 @@ Based on: ### Generated - [python v0.4.0] . ### Releases -- [PyPI v0.4.0] https://pypi.org/project/cribl-mgmt-plane/0.4.0 - . \ No newline at end of file +- [PyPI v0.4.0] https://pypi.org/project/cribl-mgmt-plane/0.4.0 - . + +## 2026-08-24 00:19:17 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.793.1 (2.928.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.4.1] . +### Releases +- [PyPI v0.4.1] https://pypi.org/project/cribl-mgmt-plane/0.4.1 - . \ 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..0a2c8c2 --- /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` | *float* | :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..d07d587 --- /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` | *float* | :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/product.md b/docs/models/product.md index 55e3863..58ada7e 100644 --- a/docs/models/product.md +++ b/docs/models/product.md @@ -15,9 +15,10 @@ value = Product.EDGE ## Values -| Name | Value | -| -------- | -------- | -| `EDGE` | edge | -| `SEARCH` | search | -| `STREAM` | stream | -| `LAKE` | lake | \ No newline at end of file +| Name | Value | +| ---------- | ---------- | +| `EDGE` | edge | +| `SEARCH` | search | +| `STREAM` | stream | +| `LAKE` | lake | +| `INSIGHTS` | insights | \ 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/billing/README.md b/docs/sdks/billing/README.md new file mode 100644 index 0000000..3b615ae --- /dev/null +++ b/docs/sdks/billing/README.md @@ -0,0 +1,214 @@ +# Billing + +## Overview + +Operations related to Billing and FinOps data + +### Available Operations + +* [get_contracts_utilization](#get_contracts_utilization) - Get contract credit utilization +* [get_credits_timeseries](#get_credits_timeseries) - Get credits timeseries +* [get_credits_stats](#get_credits_stats) - Get credit balance and consumption +* [get_credits_grants](#get_credits_grants) - Get credit grants + +## get_contracts_utilization + +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.get_contracts_utilization(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 | \*/\* | + +## get_credits_timeseries + +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.get_credits_timeseries(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 | \*/\* | + +## get_credits_stats + +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.get_credits_stats(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 | \*/\* | + +## get_credits_grants + +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.get_credits_grants(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/poetry.lock b/poetry.lock index e610da0..cee959d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -588,4 +588,4 @@ typing-extensions = ">=4.12.0" [metadata] lock-version = "2.1" python-versions = ">=3.10" -content-hash = "b9ce93184dabbd3aebeddc118a61e5e48e0be9e513c3a4433601b6005506d6ac" +content-hash = "f6a8355b7012376d6650030a1b23aaf67653ed8ccc9eae2880ccb8d9a23e3d6b" diff --git a/pyproject.toml b/pyproject.toml index 105d874..09785a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "cribl-mgmt-plane" -version = "0.4.0" +version = "0.4.1" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Speakeasy" },] readme = "README-PYPI.md" @@ -9,7 +9,7 @@ requires-python = ">=3.10" dependencies = [ "httpcore >=1.0.9", "httpx >=0.28.1", - "pydantic >=2.11.2,<2.13", + "pydantic >=2.11.2", ] [tool.poetry] diff --git a/src/cribl_mgmt_plane/_version.py b/src/cribl_mgmt_plane/_version.py index cd3491b..f18a5ee 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.4.0" +__version__: str = "0.4.1" __openapi_doc_version__: str = "1.0" -__gen_version__: str = "2.918.4" -__user_agent__: str = "speakeasy-sdk/python 0.4.0 2.918.4 1.0 cribl-mgmt-plane" +__gen_version__: str = "2.928.0" +__user_agent__: str = "speakeasy-sdk/python 0.4.1 2.928.0 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..8c95ab3 --- /dev/null +++ b/src/cribl_mgmt_plane/billing.py @@ -0,0 +1,818 @@ +"""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 Billing(BaseSDK): + r"""Operations related to Billing and FinOps data""" + + def get_contracts_utilization( + 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 get_contracts_utilization_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) + + def get_credits_timeseries( + 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 get_credits_timeseries_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) + + def get_credits_stats( + 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 get_credits_stats_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) + + def get_credits_grants( + 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 get_credits_grants_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..3240233 --- /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: float + r"""Total number of items in the response.""" + + +class CreditGrantsResponseDTO(BaseModel): + items: List[CreditGrantSchema] + r"""Credit grants for the queried period.""" + + count: float + 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..27659e1 --- /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: float + r"""Total number of items in the response.""" + + +class CreditsTimeseriesResponseDTO(BaseModel): + items: List[CreditsTimeseriesItemSchema] + r"""Credit timeseries data points.""" + + count: float + 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/productroleschema.py b/src/cribl_mgmt_plane/models/productroleschema.py index e1b2262..cbb45ca 100644 --- a/src/cribl_mgmt_plane/models/productroleschema.py +++ b/src/cribl_mgmt_plane/models/productroleschema.py @@ -15,6 +15,7 @@ class Product(str, Enum, metaclass=utils.OpenEnumMeta): SEARCH = "search" STREAM = "stream" LAKE = "lake" + INSIGHTS = "insights" class Role(str, Enum, metaclass=utils.OpenEnumMeta): 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..93e68b8 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,14 @@ class CriblMgmtPlane(BaseSDK): r"""Operations related to application health status""" api_credentials: "APICredentials" r"""Operations related to API credentials""" + billing: "Billing" + r"""Operations related to Billing and FinOps data""" 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"), }