@athenaintel/sdk 4.3.2244 → 4.3.2246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/assets/client/Client.d.ts +19 -1
- package/dist/cjs/api/resources/assets/client/Client.js +86 -1
- package/dist/cjs/api/resources/assets/client/requests/CreateAssetRequestIn.d.ts +2 -0
- package/dist/cjs/api/resources/assets/client/requests/GetAccessAssetsRequest.d.ts +12 -0
- package/dist/cjs/api/resources/assets/client/requests/GetAccessAssetsRequest.js +3 -0
- package/dist/cjs/api/resources/assets/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/databases/client/Client.d.ts +77 -4
- package/dist/cjs/api/resources/databases/client/Client.js +296 -4
- package/dist/cjs/api/resources/databases/client/requests/DatabaseComputeSettingsUpdateRequestIn.d.ts +12 -0
- package/dist/cjs/api/resources/databases/client/requests/DatabaseComputeSettingsUpdateRequestIn.js +3 -0
- package/dist/cjs/api/resources/databases/client/requests/GetSettingsDatabasesRequest.d.ts +9 -0
- package/dist/cjs/api/resources/databases/client/requests/GetSettingsDatabasesRequest.js +3 -0
- package/dist/cjs/api/resources/databases/client/requests/WakeDatabasesRequest.d.ts +9 -0
- package/dist/cjs/api/resources/databases/client/requests/WakeDatabasesRequest.js +3 -0
- package/dist/cjs/api/resources/databases/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/tools/resources/sheets/client/requests/UpdateSheetCellRequest.d.ts +3 -0
- package/dist/cjs/api/types/AssetAccessOut.d.ts +28 -0
- package/dist/cjs/api/types/AssetAccessOut.js +14 -0
- package/dist/cjs/api/types/AssetAccessSourceOut.d.ts +32 -0
- package/dist/cjs/api/types/AssetAccessSourceOut.js +22 -0
- package/dist/cjs/api/types/DatabaseComputeSettingsResponseOut.d.ts +9 -0
- package/dist/cjs/api/types/DatabaseComputeSettingsResponseOut.js +3 -0
- package/dist/cjs/api/types/DatabaseStatusResponse.d.ts +2 -0
- package/dist/cjs/api/types/DatabaseWakeResponseOut.d.ts +19 -0
- package/dist/cjs/api/types/DatabaseWakeResponseOut.js +12 -0
- package/dist/cjs/api/types/index.d.ts +4 -0
- package/dist/cjs/api/types/index.js +4 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/assets/client/Client.d.mts +19 -1
- package/dist/esm/api/resources/assets/client/Client.mjs +86 -1
- package/dist/esm/api/resources/assets/client/requests/CreateAssetRequestIn.d.mts +2 -0
- package/dist/esm/api/resources/assets/client/requests/GetAccessAssetsRequest.d.mts +12 -0
- package/dist/esm/api/resources/assets/client/requests/GetAccessAssetsRequest.mjs +2 -0
- package/dist/esm/api/resources/assets/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/databases/client/Client.d.mts +77 -4
- package/dist/esm/api/resources/databases/client/Client.mjs +296 -4
- package/dist/esm/api/resources/databases/client/requests/DatabaseComputeSettingsUpdateRequestIn.d.mts +12 -0
- package/dist/esm/api/resources/databases/client/requests/DatabaseComputeSettingsUpdateRequestIn.mjs +2 -0
- package/dist/esm/api/resources/databases/client/requests/GetSettingsDatabasesRequest.d.mts +9 -0
- package/dist/esm/api/resources/databases/client/requests/GetSettingsDatabasesRequest.mjs +2 -0
- package/dist/esm/api/resources/databases/client/requests/WakeDatabasesRequest.d.mts +9 -0
- package/dist/esm/api/resources/databases/client/requests/WakeDatabasesRequest.mjs +2 -0
- package/dist/esm/api/resources/databases/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/UpdateSheetCellRequest.d.mts +3 -0
- package/dist/esm/api/types/AssetAccessOut.d.mts +28 -0
- package/dist/esm/api/types/AssetAccessOut.mjs +11 -0
- package/dist/esm/api/types/AssetAccessSourceOut.d.mts +32 -0
- package/dist/esm/api/types/AssetAccessSourceOut.mjs +19 -0
- package/dist/esm/api/types/DatabaseComputeSettingsResponseOut.d.mts +9 -0
- package/dist/esm/api/types/DatabaseComputeSettingsResponseOut.mjs +2 -0
- package/dist/esm/api/types/DatabaseStatusResponse.d.mts +2 -0
- package/dist/esm/api/types/DatabaseWakeResponseOut.d.mts +19 -0
- package/dist/esm/api/types/DatabaseWakeResponseOut.mjs +9 -0
- package/dist/esm/api/types/index.d.mts +4 -0
- package/dist/esm/api/types/index.mjs +4 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +275 -5
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@athenaintel/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "4.3.
|
|
47
|
-
"User-Agent": "@athenaintel/sdk/4.3.
|
|
46
|
+
"X-Fern-SDK-Version": "4.3.2246",
|
|
47
|
+
"User-Agent": "@athenaintel/sdk/4.3.2246",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
"X-Athena-Session-Credential": options === null || options === void 0 ? void 0 : options.sessionCredential,
|
|
@@ -50,7 +50,7 @@ export declare class AssetsClient {
|
|
|
50
50
|
convertExcelToSheet(request: AthenaIntelligence.ConvertExcelToSheetRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.ConvertExcelToSheetResponseOut>;
|
|
51
51
|
private __convertExcelToSheet;
|
|
52
52
|
/**
|
|
53
|
-
* Create a new asset such as a spreadsheet, document, folder, database, computer, user interface, skill, collab agent, or generic doc (admin-only) in your workspace with your current permissions. Computer assets return 202 after durable submission, which commits the asset and initialization delivery intent together. Runtime provisioning continues asynchronously. Inspect the returned asset ID for progress instead of repeating creation. Computers accept the same configuration as the Athena UI's creation dialog: template, provider, cpu, memory (GiB), disk (GiB) and env_vars. Sizes must be offered by the environment's computer resource policy, and only admins may pick a size other than the template default (403 otherwise). In capability enforce mode, computer creation requires computer.create and returns 403 when denied.
|
|
53
|
+
* Create a new asset such as a spreadsheet, document, folder, database, computer, user interface, skill, collab agent, or generic doc (admin-only) in your workspace with your current permissions. Computer assets return 202 after durable submission, which commits the asset and initialization delivery intent together. Runtime provisioning continues asynchronously. Inspect the returned asset ID for progress instead of repeating creation. Computers accept the same configuration as the Athena UI's creation dialog: template, provider, cpu, memory (GiB), disk (GiB) and env_vars. Sizes must be offered by the environment's computer resource policy, and only admins may pick a size other than the template default (403 otherwise). In capability enforce mode, computer creation requires computer.create and returns 403 when denied. Databases accept suspend_timeout_seconds, the auto-suspend window from the database's Settings in Athena: 0 keeps the database running (it never suspends, and keeps using capacity), otherwise 60 to 86400 seconds. A database is provisioned in the background: poll GET /api/v0/databases/{asset_id}/compute-status until it reports running or suspended.
|
|
54
54
|
*
|
|
55
55
|
* @param {AthenaIntelligence.CreateAssetRequestIn} request
|
|
56
56
|
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -157,6 +157,24 @@ export declare class AssetsClient {
|
|
|
157
157
|
*/
|
|
158
158
|
rename(request: AthenaIntelligence.RenameAssetRequestIn, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.RenameAssetResponseOut>;
|
|
159
159
|
private __rename;
|
|
160
|
+
/**
|
|
161
|
+
* Read the access that you, or another user, have on an asset, and every grant that gives it. The level is what Athena's permission checks decide for the user in the asset's own workspace, whichever workspace is active for your key: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, and 'none' cannot open it. Each source names one grant: 'owner', 'direct' (shared with the user), 'group' (shared with a workspace group the user belongs to), 'workspace' (shared with the whole workspace), 'drive' (a role on the drive) or 'other' (access the share list does not hold, for example an environment admin). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. Without user_id the route reads your own access; you need view access to the asset and membership in its workspace. To read another user's access, pass their user_id; you need edit access to the asset, as for sharing it. A user who is not a member of the asset's workspace, or who does not exist, reads as 'none' with is_member false. A suspended member reads as 'none' with no sources, and is_member still reports their membership. When a permission check cannot be answered (for example on an asset in a drive while the authorization service is unavailable), the route answers 503 and never a level. The route never changes a permission.
|
|
162
|
+
*
|
|
163
|
+
* @param {AthenaIntelligence.GetAccessAssetsRequest} request
|
|
164
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
165
|
+
*
|
|
166
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
167
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
168
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
169
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* await client.assets.getAccess({
|
|
173
|
+
* asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
|
|
174
|
+
* })
|
|
175
|
+
*/
|
|
176
|
+
getAccess(request: AthenaIntelligence.GetAccessAssetsRequest, requestOptions?: AssetsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.AssetAccessOut>;
|
|
177
|
+
private __getAccess;
|
|
160
178
|
/**
|
|
161
179
|
* Admin only. List the edit history of a collaborative asset, newest first: who edited it, when, and under which agent/session attribution. Works for every collaborative asset type. Each item's from_clock/to_clock identify the edit for the companion delta endpoint, which reports what actually changed.
|
|
162
180
|
*
|
|
@@ -252,7 +252,7 @@ class AssetsClient {
|
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
/**
|
|
255
|
-
* Create a new asset such as a spreadsheet, document, folder, database, computer, user interface, skill, collab agent, or generic doc (admin-only) in your workspace with your current permissions. Computer assets return 202 after durable submission, which commits the asset and initialization delivery intent together. Runtime provisioning continues asynchronously. Inspect the returned asset ID for progress instead of repeating creation. Computers accept the same configuration as the Athena UI's creation dialog: template, provider, cpu, memory (GiB), disk (GiB) and env_vars. Sizes must be offered by the environment's computer resource policy, and only admins may pick a size other than the template default (403 otherwise). In capability enforce mode, computer creation requires computer.create and returns 403 when denied.
|
|
255
|
+
* Create a new asset such as a spreadsheet, document, folder, database, computer, user interface, skill, collab agent, or generic doc (admin-only) in your workspace with your current permissions. Computer assets return 202 after durable submission, which commits the asset and initialization delivery intent together. Runtime provisioning continues asynchronously. Inspect the returned asset ID for progress instead of repeating creation. Computers accept the same configuration as the Athena UI's creation dialog: template, provider, cpu, memory (GiB), disk (GiB) and env_vars. Sizes must be offered by the environment's computer resource policy, and only admins may pick a size other than the template default (403 otherwise). In capability enforce mode, computer creation requires computer.create and returns 403 when denied. Databases accept suspend_timeout_seconds, the auto-suspend window from the database's Settings in Athena: 0 keeps the database running (it never suspends, and keeps using capacity), otherwise 60 to 86400 seconds. A database is provisioned in the background: poll GET /api/v0/databases/{asset_id}/compute-status until it reports running or suspended.
|
|
256
256
|
*
|
|
257
257
|
* @param {AthenaIntelligence.CreateAssetRequestIn} request
|
|
258
258
|
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -699,6 +699,91 @@ class AssetsClient {
|
|
|
699
699
|
}
|
|
700
700
|
});
|
|
701
701
|
}
|
|
702
|
+
/**
|
|
703
|
+
* Read the access that you, or another user, have on an asset, and every grant that gives it. The level is what Athena's permission checks decide for the user in the asset's own workspace, whichever workspace is active for your key: 'view' can open the asset, 'edit' can also change it and manage its sharing, 'owner' created it and can edit it, and 'none' cannot open it. Each source names one grant: 'owner', 'direct' (shared with the user), 'group' (shared with a workspace group the user belongs to), 'workspace' (shared with the whole workspace), 'drive' (a role on the drive) or 'other' (access the share list does not hold, for example an environment admin). A folder's sharing reaches each asset inside it as that asset's own share, so a 'workspace' source on a sub-folder shows that a share of its parent folder reached it. Without user_id the route reads your own access; you need view access to the asset and membership in its workspace. To read another user's access, pass their user_id; you need edit access to the asset, as for sharing it. A user who is not a member of the asset's workspace, or who does not exist, reads as 'none' with is_member false. A suspended member reads as 'none' with no sources, and is_member still reports their membership. When a permission check cannot be answered (for example on an asset in a drive while the authorization service is unavailable), the route answers 503 and never a level. The route never changes a permission.
|
|
704
|
+
*
|
|
705
|
+
* @param {AthenaIntelligence.GetAccessAssetsRequest} request
|
|
706
|
+
* @param {AssetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
707
|
+
*
|
|
708
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
709
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
710
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
711
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* await client.assets.getAccess({
|
|
715
|
+
* asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
|
|
716
|
+
* })
|
|
717
|
+
*/
|
|
718
|
+
getAccess(request, requestOptions) {
|
|
719
|
+
return core.HttpResponsePromise.fromPromise(this.__getAccess(request, requestOptions));
|
|
720
|
+
}
|
|
721
|
+
__getAccess(request, requestOptions) {
|
|
722
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
723
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
724
|
+
const { asset_id: assetId, user_id: userId } = request;
|
|
725
|
+
const _queryParams = {};
|
|
726
|
+
if (userId !== undefined) {
|
|
727
|
+
_queryParams.user_id = userId;
|
|
728
|
+
}
|
|
729
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
730
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
731
|
+
"X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
|
|
732
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
733
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
734
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/assets/${core.url.encodePathParam(assetId)}/access`),
|
|
735
|
+
method: "GET",
|
|
736
|
+
headers: _headers,
|
|
737
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
738
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
739
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
740
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
741
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
742
|
+
logging: this._options.logging,
|
|
743
|
+
});
|
|
744
|
+
if (_response.ok) {
|
|
745
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
746
|
+
}
|
|
747
|
+
if (_response.error.reason === "status-code") {
|
|
748
|
+
switch (_response.error.statusCode) {
|
|
749
|
+
case 403:
|
|
750
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
751
|
+
case 404:
|
|
752
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
753
|
+
case 422:
|
|
754
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
755
|
+
case 503:
|
|
756
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
757
|
+
default:
|
|
758
|
+
throw new errors.AthenaIntelligenceError({
|
|
759
|
+
statusCode: _response.error.statusCode,
|
|
760
|
+
body: _response.error.body,
|
|
761
|
+
rawResponse: _response.rawResponse,
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
switch (_response.error.reason) {
|
|
766
|
+
case "non-json":
|
|
767
|
+
throw new errors.AthenaIntelligenceError({
|
|
768
|
+
statusCode: _response.error.statusCode,
|
|
769
|
+
body: _response.error.rawBody,
|
|
770
|
+
rawResponse: _response.rawResponse,
|
|
771
|
+
});
|
|
772
|
+
case "body-is-null":
|
|
773
|
+
throw new errors.AthenaIntelligenceError({
|
|
774
|
+
statusCode: _response.error.statusCode,
|
|
775
|
+
rawResponse: _response.rawResponse,
|
|
776
|
+
});
|
|
777
|
+
case "timeout":
|
|
778
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/assets/{asset_id}/access.");
|
|
779
|
+
case "unknown":
|
|
780
|
+
throw new errors.AthenaIntelligenceError({
|
|
781
|
+
message: _response.error.errorMessage,
|
|
782
|
+
rawResponse: _response.rawResponse,
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
}
|
|
702
787
|
/**
|
|
703
788
|
* Admin only. List the edit history of a collaborative asset, newest first: who edited it, when, and under which agent/session attribution. Works for every collaborative asset type. Each item's from_clock/to_clock identify the edit for the companion delta endpoint, which reports what actually changed.
|
|
704
789
|
*
|
|
@@ -28,6 +28,8 @@ export interface CreateAssetRequestIn {
|
|
|
28
28
|
provider?: string | null;
|
|
29
29
|
/** skill only. The skill's SKILL.md content. Created as a draft; publish it with POST /api/v0/assets/{asset_id}/publish. */
|
|
30
30
|
skill_config?: AthenaIntelligence.PublicSkillConfigIn | null;
|
|
31
|
+
/** Database only. Seconds without activity after which the database suspends (scales to zero): 0 means it never suspends (the compute keeps running, and keeps using capacity), otherwise 60 to 86400 (24 hours). Defaults to 1800 (30 minutes). Applied while the database is provisioned; if it cannot be applied, the database is not created and compute-status reports failed. Read or change it later with GET/PATCH /api/v0/databases/{asset_id}/settings. */
|
|
32
|
+
suspend_timeout_seconds?: number | null;
|
|
31
33
|
/** Computer only. Template key to create the computer from, as picked in the Athena UI's computer creation dialog (e.g. 'default'), or an 'environment:<asset_id>' reference to a saved environment. Defaults to the default template. Also accepted as 'snapshot'. */
|
|
32
34
|
template?: string | null;
|
|
33
35
|
/** Title for the new asset */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* asset_id: "asset_92492920-d118-42d3-95b4-00eccfe0754f"
|
|
5
|
+
* }
|
|
6
|
+
*/
|
|
7
|
+
export interface GetAccessAssetsRequest {
|
|
8
|
+
/** Unique identifier of the asset */
|
|
9
|
+
asset_id: string;
|
|
10
|
+
/** The user whose access to read. Leave it out to read your own. Reading another user's access needs edit access to the asset. */
|
|
11
|
+
user_id?: string | null;
|
|
12
|
+
}
|
|
@@ -7,6 +7,7 @@ export type { CreateAssetRequestIn } from "./CreateAssetRequestIn.js";
|
|
|
7
7
|
export type { CreateProjectRequestIn } from "./CreateProjectRequestIn.js";
|
|
8
8
|
export type { DownloadAssetsRequest } from "./DownloadAssetsRequest.js";
|
|
9
9
|
export type { DuplicateAssetRequestIn } from "./DuplicateAssetRequestIn.js";
|
|
10
|
+
export type { GetAccessAssetsRequest } from "./GetAccessAssetsRequest.js";
|
|
10
11
|
export type { GetActivityDeltaAssetsRequest } from "./GetActivityDeltaAssetsRequest.js";
|
|
11
12
|
export type { GetAssetsRequest } from "./GetAssetsRequest.js";
|
|
12
13
|
export type { ListActivityAssetsRequest } from "./ListActivityAssetsRequest.js";
|
|
@@ -16,10 +16,13 @@ export declare class DatabasesClient {
|
|
|
16
16
|
*
|
|
17
17
|
* **Status Values:**
|
|
18
18
|
* - `running` - Database is active and accepting connections
|
|
19
|
-
* - `suspended` - Database is suspended (scale-to-zero)
|
|
20
|
-
* - `starting` - Database is waking up
|
|
21
|
-
* - `
|
|
22
|
-
* - `
|
|
19
|
+
* - `suspended` - Database is suspended (scale-to-zero). It wakes on `POST /databases/{asset_id}/wake` or on the first SQL request. When `reason` is `ComputeUnschedulable`, no node could host its compute size: waking it only restarts the same wait
|
|
20
|
+
* - `starting` - Database is waking up, or its compute is being recreated
|
|
21
|
+
* - `creating` - Database is being created; it has no compute yet
|
|
22
|
+
* - `failed` - Database failed to start, or its creation failed (`message` says which)
|
|
23
|
+
* - `unknown` - Status could not be determined (the control plane did not answer); retry
|
|
24
|
+
*
|
|
25
|
+
* A database suspends (scales to zero) after `suspend_timeout_seconds` without activity; `GET`/`PATCH /databases/{asset_id}/settings` read and set that window, and 0 keeps it running. Reading the compute status or the settings never wakes a suspended database. Two things do: `POST /databases/{asset_id}/wake`, which answers at once while the compute starts, or any request that runs SQL on it, such as `POST /databases/{asset_id}/sql`, which waits for the compute up to 120 seconds; if the compute is still starting then, the answer is 503 with `Retry-After` and the statement did not run. A cold start usually takes 30 seconds to 2 minutes.
|
|
23
26
|
*
|
|
24
27
|
* @param {AthenaIntelligence.GetStatusDatabasesRequest} request
|
|
25
28
|
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -217,6 +220,53 @@ export declare class DatabasesClient {
|
|
|
217
220
|
*/
|
|
218
221
|
getTableSchema(request: AthenaIntelligence.GetTableSchemaDatabasesRequest, requestOptions?: DatabasesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.DatabaseTableSchemaResponse>;
|
|
219
222
|
private __getTableSchema;
|
|
223
|
+
/**
|
|
224
|
+
* Read the database's auto-suspend window, the same setting as auto-suspend in the database's Settings in Athena. Reading never wakes the database.
|
|
225
|
+
*
|
|
226
|
+
* A database suspends (scales to zero) after `suspend_timeout_seconds` without activity; `GET`/`PATCH /databases/{asset_id}/settings` read and set that window, and 0 keeps it running. Reading the compute status or the settings never wakes a suspended database. Two things do: `POST /databases/{asset_id}/wake`, which answers at once while the compute starts, or any request that runs SQL on it, such as `POST /databases/{asset_id}/sql`, which waits for the compute up to 120 seconds; if the compute is still starting then, the answer is 503 with `Retry-After` and the statement did not run. A cold start usually takes 30 seconds to 2 minutes.
|
|
227
|
+
*
|
|
228
|
+
* @param {AthenaIntelligence.GetSettingsDatabasesRequest} request
|
|
229
|
+
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
230
|
+
*
|
|
231
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
232
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
233
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
234
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
235
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
236
|
+
* @throws {@link AthenaIntelligence.NotImplementedError}
|
|
237
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* await client.databases.getSettings({
|
|
241
|
+
* asset_id: "asset_id"
|
|
242
|
+
* })
|
|
243
|
+
*/
|
|
244
|
+
getSettings(request: AthenaIntelligence.GetSettingsDatabasesRequest, requestOptions?: DatabasesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.DatabaseComputeSettingsResponseOut>;
|
|
245
|
+
private __getSettings;
|
|
246
|
+
/**
|
|
247
|
+
* Set the database's auto-suspend window: 0 keeps the database running (it never suspends, and keeps using compute capacity), otherwise 60 to 86400 seconds. The same setting, values and edit-access rule as auto-suspend in the database's Settings in Athena; the change applies at once and does not restart or wake the database.
|
|
248
|
+
*
|
|
249
|
+
* A database suspends (scales to zero) after `suspend_timeout_seconds` without activity; `GET`/`PATCH /databases/{asset_id}/settings` read and set that window, and 0 keeps it running. Reading the compute status or the settings never wakes a suspended database. Two things do: `POST /databases/{asset_id}/wake`, which answers at once while the compute starts, or any request that runs SQL on it, such as `POST /databases/{asset_id}/sql`, which waits for the compute up to 120 seconds; if the compute is still starting then, the answer is 503 with `Retry-After` and the statement did not run. A cold start usually takes 30 seconds to 2 minutes.
|
|
250
|
+
*
|
|
251
|
+
* @param {AthenaIntelligence.DatabaseComputeSettingsUpdateRequestIn} request
|
|
252
|
+
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
253
|
+
*
|
|
254
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
255
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
256
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
257
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
258
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
259
|
+
* @throws {@link AthenaIntelligence.NotImplementedError}
|
|
260
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* await client.databases.updateSettings({
|
|
264
|
+
* asset_id: "asset_id",
|
|
265
|
+
* suspend_timeout_seconds: 3600
|
|
266
|
+
* })
|
|
267
|
+
*/
|
|
268
|
+
updateSettings(request: AthenaIntelligence.DatabaseComputeSettingsUpdateRequestIn, requestOptions?: DatabasesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.DatabaseComputeSettingsResponseOut>;
|
|
269
|
+
private __updateSettings;
|
|
220
270
|
/**
|
|
221
271
|
* Execute a SQL statement against the database. SELECT queries return columns and rows. Non-SELECT statements (CREATE, INSERT, UPDATE, DELETE, ALTER, DROP, etc.) return execution statuses.
|
|
222
272
|
*
|
|
@@ -239,4 +289,27 @@ export declare class DatabasesClient {
|
|
|
239
289
|
*/
|
|
240
290
|
executeSql(request: AthenaIntelligence.DatabaseSqlRequest, requestOptions?: DatabasesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.DatabaseSqlResponse>;
|
|
241
291
|
private __executeSql;
|
|
292
|
+
/**
|
|
293
|
+
* Start a suspended database's compute and answer at once, without waiting for it to run. Poll `GET /databases/{asset_id}/compute-status` until it reports `running`. Waking a running database resets its idle clock and answers 200 with `running`, so it is safe to call before every batch of work. The same action as Resume Database in Athena; it needs edit access to the database.
|
|
294
|
+
*
|
|
295
|
+
* A database suspends (scales to zero) after `suspend_timeout_seconds` without activity; `GET`/`PATCH /databases/{asset_id}/settings` read and set that window, and 0 keeps it running. Reading the compute status or the settings never wakes a suspended database. Two things do: `POST /databases/{asset_id}/wake`, which answers at once while the compute starts, or any request that runs SQL on it, such as `POST /databases/{asset_id}/sql`, which waits for the compute up to 120 seconds; if the compute is still starting then, the answer is 503 with `Retry-After` and the statement did not run. A cold start usually takes 30 seconds to 2 minutes.
|
|
296
|
+
*
|
|
297
|
+
* @param {AthenaIntelligence.WakeDatabasesRequest} request
|
|
298
|
+
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
299
|
+
*
|
|
300
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
301
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
302
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
303
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
304
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
305
|
+
* @throws {@link AthenaIntelligence.NotImplementedError}
|
|
306
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* await client.databases.wake({
|
|
310
|
+
* asset_id: "asset_id"
|
|
311
|
+
* })
|
|
312
|
+
*/
|
|
313
|
+
wake(request: AthenaIntelligence.WakeDatabasesRequest, requestOptions?: DatabasesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.DatabaseWakeResponseOut>;
|
|
314
|
+
private __wake;
|
|
242
315
|
}
|
|
@@ -70,10 +70,13 @@ class DatabasesClient {
|
|
|
70
70
|
*
|
|
71
71
|
* **Status Values:**
|
|
72
72
|
* - `running` - Database is active and accepting connections
|
|
73
|
-
* - `suspended` - Database is suspended (scale-to-zero)
|
|
74
|
-
* - `starting` - Database is waking up
|
|
75
|
-
* - `
|
|
76
|
-
* - `
|
|
73
|
+
* - `suspended` - Database is suspended (scale-to-zero). It wakes on `POST /databases/{asset_id}/wake` or on the first SQL request. When `reason` is `ComputeUnschedulable`, no node could host its compute size: waking it only restarts the same wait
|
|
74
|
+
* - `starting` - Database is waking up, or its compute is being recreated
|
|
75
|
+
* - `creating` - Database is being created; it has no compute yet
|
|
76
|
+
* - `failed` - Database failed to start, or its creation failed (`message` says which)
|
|
77
|
+
* - `unknown` - Status could not be determined (the control plane did not answer); retry
|
|
78
|
+
*
|
|
79
|
+
* A database suspends (scales to zero) after `suspend_timeout_seconds` without activity; `GET`/`PATCH /databases/{asset_id}/settings` read and set that window, and 0 keeps it running. Reading the compute status or the settings never wakes a suspended database. Two things do: `POST /databases/{asset_id}/wake`, which answers at once while the compute starts, or any request that runs SQL on it, such as `POST /databases/{asset_id}/sql`, which waits for the compute up to 120 seconds; if the compute is still starting then, the answer is 503 with `Retry-After` and the statement did not run. A cold start usually takes 30 seconds to 2 minutes.
|
|
77
80
|
*
|
|
78
81
|
* @param {AthenaIntelligence.GetStatusDatabasesRequest} request
|
|
79
82
|
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -793,6 +796,200 @@ class DatabasesClient {
|
|
|
793
796
|
}
|
|
794
797
|
});
|
|
795
798
|
}
|
|
799
|
+
/**
|
|
800
|
+
* Read the database's auto-suspend window, the same setting as auto-suspend in the database's Settings in Athena. Reading never wakes the database.
|
|
801
|
+
*
|
|
802
|
+
* A database suspends (scales to zero) after `suspend_timeout_seconds` without activity; `GET`/`PATCH /databases/{asset_id}/settings` read and set that window, and 0 keeps it running. Reading the compute status or the settings never wakes a suspended database. Two things do: `POST /databases/{asset_id}/wake`, which answers at once while the compute starts, or any request that runs SQL on it, such as `POST /databases/{asset_id}/sql`, which waits for the compute up to 120 seconds; if the compute is still starting then, the answer is 503 with `Retry-After` and the statement did not run. A cold start usually takes 30 seconds to 2 minutes.
|
|
803
|
+
*
|
|
804
|
+
* @param {AthenaIntelligence.GetSettingsDatabasesRequest} request
|
|
805
|
+
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
806
|
+
*
|
|
807
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
808
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
809
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
810
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
811
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
812
|
+
* @throws {@link AthenaIntelligence.NotImplementedError}
|
|
813
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
814
|
+
*
|
|
815
|
+
* @example
|
|
816
|
+
* await client.databases.getSettings({
|
|
817
|
+
* asset_id: "asset_id"
|
|
818
|
+
* })
|
|
819
|
+
*/
|
|
820
|
+
getSettings(request, requestOptions) {
|
|
821
|
+
return core.HttpResponsePromise.fromPromise(this.__getSettings(request, requestOptions));
|
|
822
|
+
}
|
|
823
|
+
__getSettings(request, requestOptions) {
|
|
824
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
825
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
826
|
+
const { asset_id: assetId } = request;
|
|
827
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
828
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
829
|
+
"X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
|
|
830
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
831
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
832
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/databases/${core.url.encodePathParam(assetId)}/settings`),
|
|
833
|
+
method: "GET",
|
|
834
|
+
headers: _headers,
|
|
835
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
836
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
837
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
838
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
839
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
840
|
+
logging: this._options.logging,
|
|
841
|
+
});
|
|
842
|
+
if (_response.ok) {
|
|
843
|
+
return {
|
|
844
|
+
data: _response.body,
|
|
845
|
+
rawResponse: _response.rawResponse,
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
if (_response.error.reason === "status-code") {
|
|
849
|
+
switch (_response.error.statusCode) {
|
|
850
|
+
case 400:
|
|
851
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
852
|
+
case 403:
|
|
853
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
854
|
+
case 404:
|
|
855
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
856
|
+
case 409:
|
|
857
|
+
throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
|
|
858
|
+
case 422:
|
|
859
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
860
|
+
case 501:
|
|
861
|
+
throw new AthenaIntelligence.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
862
|
+
case 503:
|
|
863
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
864
|
+
default:
|
|
865
|
+
throw new errors.AthenaIntelligenceError({
|
|
866
|
+
statusCode: _response.error.statusCode,
|
|
867
|
+
body: _response.error.body,
|
|
868
|
+
rawResponse: _response.rawResponse,
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
switch (_response.error.reason) {
|
|
873
|
+
case "non-json":
|
|
874
|
+
throw new errors.AthenaIntelligenceError({
|
|
875
|
+
statusCode: _response.error.statusCode,
|
|
876
|
+
body: _response.error.rawBody,
|
|
877
|
+
rawResponse: _response.rawResponse,
|
|
878
|
+
});
|
|
879
|
+
case "body-is-null":
|
|
880
|
+
throw new errors.AthenaIntelligenceError({
|
|
881
|
+
statusCode: _response.error.statusCode,
|
|
882
|
+
rawResponse: _response.rawResponse,
|
|
883
|
+
});
|
|
884
|
+
case "timeout":
|
|
885
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/databases/{asset_id}/settings.");
|
|
886
|
+
case "unknown":
|
|
887
|
+
throw new errors.AthenaIntelligenceError({
|
|
888
|
+
message: _response.error.errorMessage,
|
|
889
|
+
rawResponse: _response.rawResponse,
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Set the database's auto-suspend window: 0 keeps the database running (it never suspends, and keeps using compute capacity), otherwise 60 to 86400 seconds. The same setting, values and edit-access rule as auto-suspend in the database's Settings in Athena; the change applies at once and does not restart or wake the database.
|
|
896
|
+
*
|
|
897
|
+
* A database suspends (scales to zero) after `suspend_timeout_seconds` without activity; `GET`/`PATCH /databases/{asset_id}/settings` read and set that window, and 0 keeps it running. Reading the compute status or the settings never wakes a suspended database. Two things do: `POST /databases/{asset_id}/wake`, which answers at once while the compute starts, or any request that runs SQL on it, such as `POST /databases/{asset_id}/sql`, which waits for the compute up to 120 seconds; if the compute is still starting then, the answer is 503 with `Retry-After` and the statement did not run. A cold start usually takes 30 seconds to 2 minutes.
|
|
898
|
+
*
|
|
899
|
+
* @param {AthenaIntelligence.DatabaseComputeSettingsUpdateRequestIn} request
|
|
900
|
+
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
901
|
+
*
|
|
902
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
903
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
904
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
905
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
906
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
907
|
+
* @throws {@link AthenaIntelligence.NotImplementedError}
|
|
908
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
909
|
+
*
|
|
910
|
+
* @example
|
|
911
|
+
* await client.databases.updateSettings({
|
|
912
|
+
* asset_id: "asset_id",
|
|
913
|
+
* suspend_timeout_seconds: 3600
|
|
914
|
+
* })
|
|
915
|
+
*/
|
|
916
|
+
updateSettings(request, requestOptions) {
|
|
917
|
+
return core.HttpResponsePromise.fromPromise(this.__updateSettings(request, requestOptions));
|
|
918
|
+
}
|
|
919
|
+
__updateSettings(request, requestOptions) {
|
|
920
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
921
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
922
|
+
const { asset_id: assetId } = request, _body = __rest(request, ["asset_id"]);
|
|
923
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
924
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
925
|
+
"X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
|
|
926
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
927
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
928
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/databases/${core.url.encodePathParam(assetId)}/settings`),
|
|
929
|
+
method: "PATCH",
|
|
930
|
+
headers: _headers,
|
|
931
|
+
contentType: "application/json",
|
|
932
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
933
|
+
requestType: "json",
|
|
934
|
+
body: _body,
|
|
935
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
936
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
937
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
938
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
939
|
+
logging: this._options.logging,
|
|
940
|
+
});
|
|
941
|
+
if (_response.ok) {
|
|
942
|
+
return {
|
|
943
|
+
data: _response.body,
|
|
944
|
+
rawResponse: _response.rawResponse,
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
if (_response.error.reason === "status-code") {
|
|
948
|
+
switch (_response.error.statusCode) {
|
|
949
|
+
case 400:
|
|
950
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
951
|
+
case 403:
|
|
952
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
953
|
+
case 404:
|
|
954
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
955
|
+
case 409:
|
|
956
|
+
throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
|
|
957
|
+
case 422:
|
|
958
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
959
|
+
case 501:
|
|
960
|
+
throw new AthenaIntelligence.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
961
|
+
case 503:
|
|
962
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
963
|
+
default:
|
|
964
|
+
throw new errors.AthenaIntelligenceError({
|
|
965
|
+
statusCode: _response.error.statusCode,
|
|
966
|
+
body: _response.error.body,
|
|
967
|
+
rawResponse: _response.rawResponse,
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
switch (_response.error.reason) {
|
|
972
|
+
case "non-json":
|
|
973
|
+
throw new errors.AthenaIntelligenceError({
|
|
974
|
+
statusCode: _response.error.statusCode,
|
|
975
|
+
body: _response.error.rawBody,
|
|
976
|
+
rawResponse: _response.rawResponse,
|
|
977
|
+
});
|
|
978
|
+
case "body-is-null":
|
|
979
|
+
throw new errors.AthenaIntelligenceError({
|
|
980
|
+
statusCode: _response.error.statusCode,
|
|
981
|
+
rawResponse: _response.rawResponse,
|
|
982
|
+
});
|
|
983
|
+
case "timeout":
|
|
984
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling PATCH /api/v0/databases/{asset_id}/settings.");
|
|
985
|
+
case "unknown":
|
|
986
|
+
throw new errors.AthenaIntelligenceError({
|
|
987
|
+
message: _response.error.errorMessage,
|
|
988
|
+
rawResponse: _response.rawResponse,
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
}
|
|
796
993
|
/**
|
|
797
994
|
* Execute a SQL statement against the database. SELECT queries return columns and rows. Non-SELECT statements (CREATE, INSERT, UPDATE, DELETE, ALTER, DROP, etc.) return execution statuses.
|
|
798
995
|
*
|
|
@@ -890,5 +1087,100 @@ class DatabasesClient {
|
|
|
890
1087
|
}
|
|
891
1088
|
});
|
|
892
1089
|
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Start a suspended database's compute and answer at once, without waiting for it to run. Poll `GET /databases/{asset_id}/compute-status` until it reports `running`. Waking a running database resets its idle clock and answers 200 with `running`, so it is safe to call before every batch of work. The same action as Resume Database in Athena; it needs edit access to the database.
|
|
1092
|
+
*
|
|
1093
|
+
* A database suspends (scales to zero) after `suspend_timeout_seconds` without activity; `GET`/`PATCH /databases/{asset_id}/settings` read and set that window, and 0 keeps it running. Reading the compute status or the settings never wakes a suspended database. Two things do: `POST /databases/{asset_id}/wake`, which answers at once while the compute starts, or any request that runs SQL on it, such as `POST /databases/{asset_id}/sql`, which waits for the compute up to 120 seconds; if the compute is still starting then, the answer is 503 with `Retry-After` and the statement did not run. A cold start usually takes 30 seconds to 2 minutes.
|
|
1094
|
+
*
|
|
1095
|
+
* @param {AthenaIntelligence.WakeDatabasesRequest} request
|
|
1096
|
+
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1097
|
+
*
|
|
1098
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
1099
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
1100
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
1101
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
1102
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
1103
|
+
* @throws {@link AthenaIntelligence.NotImplementedError}
|
|
1104
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
1105
|
+
*
|
|
1106
|
+
* @example
|
|
1107
|
+
* await client.databases.wake({
|
|
1108
|
+
* asset_id: "asset_id"
|
|
1109
|
+
* })
|
|
1110
|
+
*/
|
|
1111
|
+
wake(request, requestOptions) {
|
|
1112
|
+
return core.HttpResponsePromise.fromPromise(this.__wake(request, requestOptions));
|
|
1113
|
+
}
|
|
1114
|
+
__wake(request, requestOptions) {
|
|
1115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1116
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1117
|
+
const { asset_id: assetId } = request;
|
|
1118
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1119
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
1120
|
+
"X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
|
|
1121
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1122
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
1123
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/databases/${core.url.encodePathParam(assetId)}/wake`),
|
|
1124
|
+
method: "POST",
|
|
1125
|
+
headers: _headers,
|
|
1126
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1127
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
1128
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
1129
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1130
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
1131
|
+
logging: this._options.logging,
|
|
1132
|
+
});
|
|
1133
|
+
if (_response.ok) {
|
|
1134
|
+
return {
|
|
1135
|
+
data: _response.body,
|
|
1136
|
+
rawResponse: _response.rawResponse,
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
if (_response.error.reason === "status-code") {
|
|
1140
|
+
switch (_response.error.statusCode) {
|
|
1141
|
+
case 400:
|
|
1142
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
1143
|
+
case 403:
|
|
1144
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1145
|
+
case 404:
|
|
1146
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1147
|
+
case 409:
|
|
1148
|
+
throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
|
|
1149
|
+
case 422:
|
|
1150
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
1151
|
+
case 501:
|
|
1152
|
+
throw new AthenaIntelligence.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
1153
|
+
case 503:
|
|
1154
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
1155
|
+
default:
|
|
1156
|
+
throw new errors.AthenaIntelligenceError({
|
|
1157
|
+
statusCode: _response.error.statusCode,
|
|
1158
|
+
body: _response.error.body,
|
|
1159
|
+
rawResponse: _response.rawResponse,
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
switch (_response.error.reason) {
|
|
1164
|
+
case "non-json":
|
|
1165
|
+
throw new errors.AthenaIntelligenceError({
|
|
1166
|
+
statusCode: _response.error.statusCode,
|
|
1167
|
+
body: _response.error.rawBody,
|
|
1168
|
+
rawResponse: _response.rawResponse,
|
|
1169
|
+
});
|
|
1170
|
+
case "body-is-null":
|
|
1171
|
+
throw new errors.AthenaIntelligenceError({
|
|
1172
|
+
statusCode: _response.error.statusCode,
|
|
1173
|
+
rawResponse: _response.rawResponse,
|
|
1174
|
+
});
|
|
1175
|
+
case "timeout":
|
|
1176
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/databases/{asset_id}/wake.");
|
|
1177
|
+
case "unknown":
|
|
1178
|
+
throw new errors.AthenaIntelligenceError({
|
|
1179
|
+
message: _response.error.errorMessage,
|
|
1180
|
+
rawResponse: _response.rawResponse,
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
893
1185
|
}
|
|
894
1186
|
exports.DatabasesClient = DatabasesClient;
|
package/dist/cjs/api/resources/databases/client/requests/DatabaseComputeSettingsUpdateRequestIn.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* asset_id: "asset_id",
|
|
5
|
+
* suspend_timeout_seconds: 3600
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface DatabaseComputeSettingsUpdateRequestIn {
|
|
9
|
+
asset_id: string;
|
|
10
|
+
/** Seconds without activity after which the database suspends (scales to zero). 0 means it never suspends: the compute keeps running, and keeps using capacity, until you change this. Otherwise 60 to 86400 (24 hours). A new database starts with 1800 (30 minutes). The same setting as auto-suspend in the database's Settings in Athena. */
|
|
11
|
+
suspend_timeout_seconds: number;
|
|
12
|
+
}
|