@athenaintel/sdk 4.3.2243 → 4.3.2245
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 +1 -1
- package/dist/cjs/api/resources/assets/client/Client.js +1 -1
- package/dist/cjs/api/resources/assets/client/requests/CreateAssetRequestIn.d.ts +2 -0
- package/dist/cjs/api/resources/computer/client/Client.d.ts +30 -2
- package/dist/cjs/api/resources/computer/client/Client.js +100 -2
- package/dist/cjs/api/resources/computer/client/requests/GetStatusComputerRequest.d.ts +9 -0
- package/dist/cjs/api/resources/computer/client/requests/GetStatusComputerRequest.js +3 -0
- package/dist/cjs/api/resources/computer/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/ComputerStatusResponseOut.d.ts +33 -0
- package/dist/cjs/api/types/ComputerStatusResponseOut.js +19 -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 +3 -0
- package/dist/cjs/api/types/index.js +3 -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 +1 -1
- package/dist/esm/api/resources/assets/client/Client.mjs +1 -1
- package/dist/esm/api/resources/assets/client/requests/CreateAssetRequestIn.d.mts +2 -0
- package/dist/esm/api/resources/computer/client/Client.d.mts +30 -2
- package/dist/esm/api/resources/computer/client/Client.mjs +100 -2
- package/dist/esm/api/resources/computer/client/requests/GetStatusComputerRequest.d.mts +9 -0
- package/dist/esm/api/resources/computer/client/requests/GetStatusComputerRequest.mjs +2 -0
- package/dist/esm/api/resources/computer/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/ComputerStatusResponseOut.d.mts +33 -0
- package/dist/esm/api/types/ComputerStatusResponseOut.mjs +16 -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 +3 -0
- package/dist/esm/api/types/index.mjs +3 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +285 -7
|
@@ -69,7 +69,7 @@ export declare class ComputerClient {
|
|
|
69
69
|
getSshAccess(request: AthenaIntelligence.GetSshAccessComputerRequest, requestOptions?: ComputerClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.SshAccessInfoOut>;
|
|
70
70
|
private __getSshAccess;
|
|
71
71
|
/**
|
|
72
|
-
* Generate a time-limited SSH access token for a computer asset. Returns a full SSH command and token that can be used to connect to the computer's underlying VM and run commands. The computer must support SSH access and
|
|
72
|
+
* Generate a time-limited SSH access token for a computer asset. Returns a full SSH command and token that can be used to connect to the computer's underlying VM and run commands. The computer must support SSH access. If it is stopped, this call starts it first and can take as long as `start_computer`; after an explicit Stop it returns 409 until you call `start_computer`. Use `get_status` to see whether the computer is ready.
|
|
73
73
|
*
|
|
74
74
|
* @param {AthenaIntelligence.CreateSshAccessRequestIn} request
|
|
75
75
|
* @param {ComputerClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -147,7 +147,7 @@ export declare class ComputerClient {
|
|
|
147
147
|
revokeSshAccessToken(request: AthenaIntelligence.RevokeSshAccessTokenComputerRequest, requestOptions?: ComputerClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.RevokeSshAccessResponseOut>;
|
|
148
148
|
private __revokeSshAccessToken;
|
|
149
149
|
/**
|
|
150
|
-
* Start a stopped computer's runtime and wait for it to come up — the same operation as the Start button in Athena. Idempotent for a running computer. Returns 409 when the computer's provider does not support lifecycle operations.
|
|
150
|
+
* Start a stopped computer's runtime and wait for it to come up — the same operation as the Start button in Athena. Idempotent for a running computer, and it clears an explicit stop. `state` is `started` once the runtime is up; the guest can need a few more seconds, so poll `get_status` until `ready` is true before you rely on commands or SSH. A proxy in front of the API can end this request after about 60 seconds while the start continues on the server; then poll `get_status`. Returns 409 when the computer's provider does not support lifecycle operations.
|
|
151
151
|
*
|
|
152
152
|
* @param {AthenaIntelligence.StartComputerComputerRequest} request
|
|
153
153
|
* @param {ComputerClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -165,6 +165,34 @@ export declare class ComputerClient {
|
|
|
165
165
|
*/
|
|
166
166
|
startComputer(request: AthenaIntelligence.StartComputerComputerRequest, requestOptions?: ComputerClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.ComputerLifecycleResponseOut>;
|
|
167
167
|
private __startComputer;
|
|
168
|
+
/**
|
|
169
|
+
* Read an existing computer's live runtime state and whether it is ready, without starting, waking, or repairing it. Works for every computer, including those created before durable initialization (`get_initialization` reports creation-time progress only). Requires membership in the computer's workspace and VIEW access. This read does not count as activity, so polling it does not keep the computer awake.
|
|
170
|
+
*
|
|
171
|
+
* **Waiting for a computer.** Call `start_computer`, then poll this endpoint every few seconds until `ready` is true; stop polling when `not_ready_reason` is `launcher_outdated`. `start_computer` waits for the computer, but a proxy in front of the API can end a long request (about 60 seconds on Athena's ingress) while the start continues on the server. The server waits up to 210 seconds by default for the computer's runtime to boot before it reports a failure, and Athena alerts its operators when the 90th percentile of starts goes above 3 minutes.
|
|
172
|
+
*
|
|
173
|
+
* **Auto-stop.** A computer stops after its `auto_stop_minutes` of inactivity (60 minutes unless the computer or the deployment sets another value; 0 means it never stops on its own). Activity is work inside the computer — commands, terminal and SSH sessions, file operations — and requests to its deployed URLs. Status reads are not activity.
|
|
174
|
+
*
|
|
175
|
+
* **The asset record's `status`.** The computer's `status` in `GET /assets/{asset_id}` records the last lifecycle change Athena recorded (create, Start, Stop); it is not a live read. It can read `running` while the computer is stopped, for example after an idle auto-stop, or `stopped` after something woke it. Use this endpoint for the live state.
|
|
176
|
+
*
|
|
177
|
+
* Returns 403 when the caller is not a member of the computer's workspace, 409 while the computer is still being created or when its creation failed, 404 when the asset does not exist or its runtime is gone for good (stop polling), and 502 when the runtime could not be read (retry).
|
|
178
|
+
*
|
|
179
|
+
* @param {AthenaIntelligence.GetStatusComputerRequest} request
|
|
180
|
+
* @param {ComputerClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
181
|
+
*
|
|
182
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
183
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
184
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
185
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
186
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
187
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* await client.computer.getStatus({
|
|
191
|
+
* asset_id: "asset_id"
|
|
192
|
+
* })
|
|
193
|
+
*/
|
|
194
|
+
getStatus(request: AthenaIntelligence.GetStatusComputerRequest, requestOptions?: ComputerClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.ComputerStatusResponseOut>;
|
|
195
|
+
private __getStatus;
|
|
168
196
|
/**
|
|
169
197
|
* Stop (suspend) a running computer's runtime — the same operation as the Stop button in Athena. The computer's files persist and it can be started again with `start_computer`. Returns 409 when the provider does not support lifecycle operations or when the stop was refused because the workspace could not be saved (the computer is left running; retry).
|
|
170
198
|
*
|
|
@@ -289,7 +289,7 @@ export class ComputerClient {
|
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
/**
|
|
292
|
-
* Generate a time-limited SSH access token for a computer asset. Returns a full SSH command and token that can be used to connect to the computer's underlying VM and run commands. The computer must support SSH access and
|
|
292
|
+
* Generate a time-limited SSH access token for a computer asset. Returns a full SSH command and token that can be used to connect to the computer's underlying VM and run commands. The computer must support SSH access. If it is stopped, this call starts it first and can take as long as `start_computer`; after an explicit Stop it returns 409 until you call `start_computer`. Use `get_status` to see whether the computer is ready.
|
|
293
293
|
*
|
|
294
294
|
* @param {AthenaIntelligence.CreateSshAccessRequestIn} request
|
|
295
295
|
* @param {ComputerClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -643,7 +643,7 @@ export class ComputerClient {
|
|
|
643
643
|
});
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
646
|
-
* Start a stopped computer's runtime and wait for it to come up — the same operation as the Start button in Athena. Idempotent for a running computer. Returns 409 when the computer's provider does not support lifecycle operations.
|
|
646
|
+
* Start a stopped computer's runtime and wait for it to come up — the same operation as the Start button in Athena. Idempotent for a running computer, and it clears an explicit stop. `state` is `started` once the runtime is up; the guest can need a few more seconds, so poll `get_status` until `ready` is true before you rely on commands or SSH. A proxy in front of the API can end this request after about 60 seconds while the start continues on the server; then poll `get_status`. Returns 409 when the computer's provider does not support lifecycle operations.
|
|
647
647
|
*
|
|
648
648
|
* @param {AthenaIntelligence.StartComputerComputerRequest} request
|
|
649
649
|
* @param {ComputerClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -729,6 +729,104 @@ export class ComputerClient {
|
|
|
729
729
|
}
|
|
730
730
|
});
|
|
731
731
|
}
|
|
732
|
+
/**
|
|
733
|
+
* Read an existing computer's live runtime state and whether it is ready, without starting, waking, or repairing it. Works for every computer, including those created before durable initialization (`get_initialization` reports creation-time progress only). Requires membership in the computer's workspace and VIEW access. This read does not count as activity, so polling it does not keep the computer awake.
|
|
734
|
+
*
|
|
735
|
+
* **Waiting for a computer.** Call `start_computer`, then poll this endpoint every few seconds until `ready` is true; stop polling when `not_ready_reason` is `launcher_outdated`. `start_computer` waits for the computer, but a proxy in front of the API can end a long request (about 60 seconds on Athena's ingress) while the start continues on the server. The server waits up to 210 seconds by default for the computer's runtime to boot before it reports a failure, and Athena alerts its operators when the 90th percentile of starts goes above 3 minutes.
|
|
736
|
+
*
|
|
737
|
+
* **Auto-stop.** A computer stops after its `auto_stop_minutes` of inactivity (60 minutes unless the computer or the deployment sets another value; 0 means it never stops on its own). Activity is work inside the computer — commands, terminal and SSH sessions, file operations — and requests to its deployed URLs. Status reads are not activity.
|
|
738
|
+
*
|
|
739
|
+
* **The asset record's `status`.** The computer's `status` in `GET /assets/{asset_id}` records the last lifecycle change Athena recorded (create, Start, Stop); it is not a live read. It can read `running` while the computer is stopped, for example after an idle auto-stop, or `stopped` after something woke it. Use this endpoint for the live state.
|
|
740
|
+
*
|
|
741
|
+
* Returns 403 when the caller is not a member of the computer's workspace, 409 while the computer is still being created or when its creation failed, 404 when the asset does not exist or its runtime is gone for good (stop polling), and 502 when the runtime could not be read (retry).
|
|
742
|
+
*
|
|
743
|
+
* @param {AthenaIntelligence.GetStatusComputerRequest} request
|
|
744
|
+
* @param {ComputerClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
745
|
+
*
|
|
746
|
+
* @throws {@link AthenaIntelligence.UnauthorizedError}
|
|
747
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
748
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
749
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
750
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
751
|
+
* @throws {@link AthenaIntelligence.BadGatewayError}
|
|
752
|
+
*
|
|
753
|
+
* @example
|
|
754
|
+
* await client.computer.getStatus({
|
|
755
|
+
* asset_id: "asset_id"
|
|
756
|
+
* })
|
|
757
|
+
*/
|
|
758
|
+
getStatus(request, requestOptions) {
|
|
759
|
+
return core.HttpResponsePromise.fromPromise(this.__getStatus(request, requestOptions));
|
|
760
|
+
}
|
|
761
|
+
__getStatus(request, requestOptions) {
|
|
762
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
763
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
764
|
+
const { asset_id: assetId } = request;
|
|
765
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
766
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
767
|
+
"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,
|
|
768
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
769
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
770
|
+
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/computer/${core.url.encodePathParam(assetId)}/status`),
|
|
771
|
+
method: "GET",
|
|
772
|
+
headers: _headers,
|
|
773
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
774
|
+
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,
|
|
775
|
+
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,
|
|
776
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
777
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
778
|
+
logging: this._options.logging,
|
|
779
|
+
});
|
|
780
|
+
if (_response.ok) {
|
|
781
|
+
return {
|
|
782
|
+
data: _response.body,
|
|
783
|
+
rawResponse: _response.rawResponse,
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
if (_response.error.reason === "status-code") {
|
|
787
|
+
switch (_response.error.statusCode) {
|
|
788
|
+
case 401:
|
|
789
|
+
throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
790
|
+
case 403:
|
|
791
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
792
|
+
case 404:
|
|
793
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
794
|
+
case 409:
|
|
795
|
+
throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
|
|
796
|
+
case 422:
|
|
797
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
798
|
+
case 502:
|
|
799
|
+
throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
800
|
+
default:
|
|
801
|
+
throw new errors.AthenaIntelligenceError({
|
|
802
|
+
statusCode: _response.error.statusCode,
|
|
803
|
+
body: _response.error.body,
|
|
804
|
+
rawResponse: _response.rawResponse,
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
switch (_response.error.reason) {
|
|
809
|
+
case "non-json":
|
|
810
|
+
throw new errors.AthenaIntelligenceError({
|
|
811
|
+
statusCode: _response.error.statusCode,
|
|
812
|
+
body: _response.error.rawBody,
|
|
813
|
+
rawResponse: _response.rawResponse,
|
|
814
|
+
});
|
|
815
|
+
case "body-is-null":
|
|
816
|
+
throw new errors.AthenaIntelligenceError({
|
|
817
|
+
statusCode: _response.error.statusCode,
|
|
818
|
+
rawResponse: _response.rawResponse,
|
|
819
|
+
});
|
|
820
|
+
case "timeout":
|
|
821
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/computer/{asset_id}/status.");
|
|
822
|
+
case "unknown":
|
|
823
|
+
throw new errors.AthenaIntelligenceError({
|
|
824
|
+
message: _response.error.errorMessage,
|
|
825
|
+
rawResponse: _response.rawResponse,
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
}
|
|
732
830
|
/**
|
|
733
831
|
* Stop (suspend) a running computer's runtime — the same operation as the Stop button in Athena. The computer's files persist and it can be started again with `start_computer`. Returns 409 when the provider does not support lifecycle operations or when the stop was refused because the workspace could not be saved (the computer is left running; retry).
|
|
734
832
|
*
|
|
@@ -2,6 +2,7 @@ export type { CreateSshAccessRequestIn } from "./CreateSshAccessRequestIn.mjs";
|
|
|
2
2
|
export type { DeployComputerRequestIn } from "./DeployComputerRequestIn.mjs";
|
|
3
3
|
export type { GetInitializationComputerRequest } from "./GetInitializationComputerRequest.mjs";
|
|
4
4
|
export type { GetSshAccessComputerRequest } from "./GetSshAccessComputerRequest.mjs";
|
|
5
|
+
export type { GetStatusComputerRequest } from "./GetStatusComputerRequest.mjs";
|
|
5
6
|
export type { ListSshAccessTokensComputerRequest } from "./ListSshAccessTokensComputerRequest.mjs";
|
|
6
7
|
export type { RevokeSshAccessRequestIn } from "./RevokeSshAccessRequestIn.mjs";
|
|
7
8
|
export type { RevokeSshAccessTokenComputerRequest } from "./RevokeSshAccessTokenComputerRequest.mjs";
|
|
@@ -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
|
}
|
|
@@ -34,10 +34,13 @@ export class DatabasesClient {
|
|
|
34
34
|
*
|
|
35
35
|
* **Status Values:**
|
|
36
36
|
* - `running` - Database is active and accepting connections
|
|
37
|
-
* - `suspended` - Database is suspended (scale-to-zero)
|
|
38
|
-
* - `starting` - Database is waking up
|
|
39
|
-
* - `
|
|
40
|
-
* - `
|
|
37
|
+
* - `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
|
|
38
|
+
* - `starting` - Database is waking up, or its compute is being recreated
|
|
39
|
+
* - `creating` - Database is being created; it has no compute yet
|
|
40
|
+
* - `failed` - Database failed to start, or its creation failed (`message` says which)
|
|
41
|
+
* - `unknown` - Status could not be determined (the control plane did not answer); retry
|
|
42
|
+
*
|
|
43
|
+
* 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.
|
|
41
44
|
*
|
|
42
45
|
* @param {AthenaIntelligence.GetStatusDatabasesRequest} request
|
|
43
46
|
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -757,6 +760,200 @@ export class DatabasesClient {
|
|
|
757
760
|
}
|
|
758
761
|
});
|
|
759
762
|
}
|
|
763
|
+
/**
|
|
764
|
+
* 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.
|
|
765
|
+
*
|
|
766
|
+
* 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.
|
|
767
|
+
*
|
|
768
|
+
* @param {AthenaIntelligence.GetSettingsDatabasesRequest} request
|
|
769
|
+
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
770
|
+
*
|
|
771
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
772
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
773
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
774
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
775
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
776
|
+
* @throws {@link AthenaIntelligence.NotImplementedError}
|
|
777
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
778
|
+
*
|
|
779
|
+
* @example
|
|
780
|
+
* await client.databases.getSettings({
|
|
781
|
+
* asset_id: "asset_id"
|
|
782
|
+
* })
|
|
783
|
+
*/
|
|
784
|
+
getSettings(request, requestOptions) {
|
|
785
|
+
return core.HttpResponsePromise.fromPromise(this.__getSettings(request, requestOptions));
|
|
786
|
+
}
|
|
787
|
+
__getSettings(request, requestOptions) {
|
|
788
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
789
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
790
|
+
const { asset_id: assetId } = request;
|
|
791
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
792
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
793
|
+
"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,
|
|
794
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
795
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
796
|
+
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`),
|
|
797
|
+
method: "GET",
|
|
798
|
+
headers: _headers,
|
|
799
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
800
|
+
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,
|
|
801
|
+
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,
|
|
802
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
803
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
804
|
+
logging: this._options.logging,
|
|
805
|
+
});
|
|
806
|
+
if (_response.ok) {
|
|
807
|
+
return {
|
|
808
|
+
data: _response.body,
|
|
809
|
+
rawResponse: _response.rawResponse,
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
if (_response.error.reason === "status-code") {
|
|
813
|
+
switch (_response.error.statusCode) {
|
|
814
|
+
case 400:
|
|
815
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
816
|
+
case 403:
|
|
817
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
818
|
+
case 404:
|
|
819
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
820
|
+
case 409:
|
|
821
|
+
throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
|
|
822
|
+
case 422:
|
|
823
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
824
|
+
case 501:
|
|
825
|
+
throw new AthenaIntelligence.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
826
|
+
case 503:
|
|
827
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
828
|
+
default:
|
|
829
|
+
throw new errors.AthenaIntelligenceError({
|
|
830
|
+
statusCode: _response.error.statusCode,
|
|
831
|
+
body: _response.error.body,
|
|
832
|
+
rawResponse: _response.rawResponse,
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
switch (_response.error.reason) {
|
|
837
|
+
case "non-json":
|
|
838
|
+
throw new errors.AthenaIntelligenceError({
|
|
839
|
+
statusCode: _response.error.statusCode,
|
|
840
|
+
body: _response.error.rawBody,
|
|
841
|
+
rawResponse: _response.rawResponse,
|
|
842
|
+
});
|
|
843
|
+
case "body-is-null":
|
|
844
|
+
throw new errors.AthenaIntelligenceError({
|
|
845
|
+
statusCode: _response.error.statusCode,
|
|
846
|
+
rawResponse: _response.rawResponse,
|
|
847
|
+
});
|
|
848
|
+
case "timeout":
|
|
849
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/databases/{asset_id}/settings.");
|
|
850
|
+
case "unknown":
|
|
851
|
+
throw new errors.AthenaIntelligenceError({
|
|
852
|
+
message: _response.error.errorMessage,
|
|
853
|
+
rawResponse: _response.rawResponse,
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* 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.
|
|
860
|
+
*
|
|
861
|
+
* 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.
|
|
862
|
+
*
|
|
863
|
+
* @param {AthenaIntelligence.DatabaseComputeSettingsUpdateRequestIn} request
|
|
864
|
+
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
865
|
+
*
|
|
866
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
867
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
868
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
869
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
870
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
871
|
+
* @throws {@link AthenaIntelligence.NotImplementedError}
|
|
872
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
873
|
+
*
|
|
874
|
+
* @example
|
|
875
|
+
* await client.databases.updateSettings({
|
|
876
|
+
* asset_id: "asset_id",
|
|
877
|
+
* suspend_timeout_seconds: 3600
|
|
878
|
+
* })
|
|
879
|
+
*/
|
|
880
|
+
updateSettings(request, requestOptions) {
|
|
881
|
+
return core.HttpResponsePromise.fromPromise(this.__updateSettings(request, requestOptions));
|
|
882
|
+
}
|
|
883
|
+
__updateSettings(request, requestOptions) {
|
|
884
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
885
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
886
|
+
const { asset_id: assetId } = request, _body = __rest(request, ["asset_id"]);
|
|
887
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
888
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
889
|
+
"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,
|
|
890
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
891
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
892
|
+
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`),
|
|
893
|
+
method: "PATCH",
|
|
894
|
+
headers: _headers,
|
|
895
|
+
contentType: "application/json",
|
|
896
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
897
|
+
requestType: "json",
|
|
898
|
+
body: _body,
|
|
899
|
+
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,
|
|
900
|
+
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,
|
|
901
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
902
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
903
|
+
logging: this._options.logging,
|
|
904
|
+
});
|
|
905
|
+
if (_response.ok) {
|
|
906
|
+
return {
|
|
907
|
+
data: _response.body,
|
|
908
|
+
rawResponse: _response.rawResponse,
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
if (_response.error.reason === "status-code") {
|
|
912
|
+
switch (_response.error.statusCode) {
|
|
913
|
+
case 400:
|
|
914
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
915
|
+
case 403:
|
|
916
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
917
|
+
case 404:
|
|
918
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
919
|
+
case 409:
|
|
920
|
+
throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
|
|
921
|
+
case 422:
|
|
922
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
923
|
+
case 501:
|
|
924
|
+
throw new AthenaIntelligence.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
925
|
+
case 503:
|
|
926
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
927
|
+
default:
|
|
928
|
+
throw new errors.AthenaIntelligenceError({
|
|
929
|
+
statusCode: _response.error.statusCode,
|
|
930
|
+
body: _response.error.body,
|
|
931
|
+
rawResponse: _response.rawResponse,
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
switch (_response.error.reason) {
|
|
936
|
+
case "non-json":
|
|
937
|
+
throw new errors.AthenaIntelligenceError({
|
|
938
|
+
statusCode: _response.error.statusCode,
|
|
939
|
+
body: _response.error.rawBody,
|
|
940
|
+
rawResponse: _response.rawResponse,
|
|
941
|
+
});
|
|
942
|
+
case "body-is-null":
|
|
943
|
+
throw new errors.AthenaIntelligenceError({
|
|
944
|
+
statusCode: _response.error.statusCode,
|
|
945
|
+
rawResponse: _response.rawResponse,
|
|
946
|
+
});
|
|
947
|
+
case "timeout":
|
|
948
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling PATCH /api/v0/databases/{asset_id}/settings.");
|
|
949
|
+
case "unknown":
|
|
950
|
+
throw new errors.AthenaIntelligenceError({
|
|
951
|
+
message: _response.error.errorMessage,
|
|
952
|
+
rawResponse: _response.rawResponse,
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
}
|
|
760
957
|
/**
|
|
761
958
|
* 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.
|
|
762
959
|
*
|
|
@@ -854,4 +1051,99 @@ export class DatabasesClient {
|
|
|
854
1051
|
}
|
|
855
1052
|
});
|
|
856
1053
|
}
|
|
1054
|
+
/**
|
|
1055
|
+
* 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.
|
|
1056
|
+
*
|
|
1057
|
+
* 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.
|
|
1058
|
+
*
|
|
1059
|
+
* @param {AthenaIntelligence.WakeDatabasesRequest} request
|
|
1060
|
+
* @param {DatabasesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1061
|
+
*
|
|
1062
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
1063
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
1064
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
1065
|
+
* @throws {@link AthenaIntelligence.ConflictError}
|
|
1066
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
1067
|
+
* @throws {@link AthenaIntelligence.NotImplementedError}
|
|
1068
|
+
* @throws {@link AthenaIntelligence.ServiceUnavailableError}
|
|
1069
|
+
*
|
|
1070
|
+
* @example
|
|
1071
|
+
* await client.databases.wake({
|
|
1072
|
+
* asset_id: "asset_id"
|
|
1073
|
+
* })
|
|
1074
|
+
*/
|
|
1075
|
+
wake(request, requestOptions) {
|
|
1076
|
+
return core.HttpResponsePromise.fromPromise(this.__wake(request, requestOptions));
|
|
1077
|
+
}
|
|
1078
|
+
__wake(request, requestOptions) {
|
|
1079
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1080
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1081
|
+
const { asset_id: assetId } = request;
|
|
1082
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1083
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
1084
|
+
"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,
|
|
1085
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1086
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
1087
|
+
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`),
|
|
1088
|
+
method: "POST",
|
|
1089
|
+
headers: _headers,
|
|
1090
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
1091
|
+
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,
|
|
1092
|
+
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,
|
|
1093
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1094
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
1095
|
+
logging: this._options.logging,
|
|
1096
|
+
});
|
|
1097
|
+
if (_response.ok) {
|
|
1098
|
+
return {
|
|
1099
|
+
data: _response.body,
|
|
1100
|
+
rawResponse: _response.rawResponse,
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
if (_response.error.reason === "status-code") {
|
|
1104
|
+
switch (_response.error.statusCode) {
|
|
1105
|
+
case 400:
|
|
1106
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
1107
|
+
case 403:
|
|
1108
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
1109
|
+
case 404:
|
|
1110
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1111
|
+
case 409:
|
|
1112
|
+
throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
|
|
1113
|
+
case 422:
|
|
1114
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
1115
|
+
case 501:
|
|
1116
|
+
throw new AthenaIntelligence.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
1117
|
+
case 503:
|
|
1118
|
+
throw new AthenaIntelligence.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
1119
|
+
default:
|
|
1120
|
+
throw new errors.AthenaIntelligenceError({
|
|
1121
|
+
statusCode: _response.error.statusCode,
|
|
1122
|
+
body: _response.error.body,
|
|
1123
|
+
rawResponse: _response.rawResponse,
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
switch (_response.error.reason) {
|
|
1128
|
+
case "non-json":
|
|
1129
|
+
throw new errors.AthenaIntelligenceError({
|
|
1130
|
+
statusCode: _response.error.statusCode,
|
|
1131
|
+
body: _response.error.rawBody,
|
|
1132
|
+
rawResponse: _response.rawResponse,
|
|
1133
|
+
});
|
|
1134
|
+
case "body-is-null":
|
|
1135
|
+
throw new errors.AthenaIntelligenceError({
|
|
1136
|
+
statusCode: _response.error.statusCode,
|
|
1137
|
+
rawResponse: _response.rawResponse,
|
|
1138
|
+
});
|
|
1139
|
+
case "timeout":
|
|
1140
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/databases/{asset_id}/wake.");
|
|
1141
|
+
case "unknown":
|
|
1142
|
+
throw new errors.AthenaIntelligenceError({
|
|
1143
|
+
message: _response.error.errorMessage,
|
|
1144
|
+
rawResponse: _response.rawResponse,
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
857
1149
|
}
|