@winglibs/sagemaker
Version:
The library enables owners of a trained sagemaker model, to access its Endpoints from a winglang inflight code.
61 lines • 2.13 kB
JavaScript
;
const $stdlib = require('@winglang/sdk');
const $macros = require("@winglang/sdk/lib/macros");
const std = $stdlib.std;
const $helpers = $stdlib.helpers;
const $extern = $helpers.createExternRequire(__dirname);
const $types = require("./types.cjs");
let $preflightTypesMap = {};
const types = $helpers.bringJs(`${__dirname}/preflight.types-1.cjs`, $preflightTypesMap);
const aws = $stdlib.aws;
class SageMaker_tfaws extends $stdlib.std.Resource {
constructor($scope, $id, endpointName, inferenceComponentName) {
super($scope, $id);
this.endpointName = endpointName;
this.inferenceComponentName = inferenceComponentName;
}
onLift(host, ops) {
{
const $if_let_value = (aws.Function.from(host));
if ($if_let_value != undefined) {
const lambda = $if_let_value;
(lambda.addPolicyStatements(({"actions": ["sagemaker:InvokeEndpoint"], "effect": aws.Effect.ALLOW, "resources": [String.raw({ raw: ["arn:aws:sagemaker:*:*:endpoint/", ""] }, $macros.__String_lowercase(false, this.endpointName, )), String.raw({ raw: ["arn:aws:sagemaker:*:*:inference-component/", ""] }, $macros.__String_lowercase(false, this.inferenceComponentName, ))]})));
}
}
}
static _toInflightType() {
return `
require("${$helpers.normalPath(__dirname)}/inflight.SageMaker_tfaws-2.cjs")({
})
`;
}
_liftedState() {
return {
...(super._liftedState?.() ?? {}),
$this_endpointName: $stdlib.core.liftObject(this.endpointName),
$this_inferenceComponentName: $stdlib.core.liftObject(this.inferenceComponentName),
};
}
get _liftMap() {
return ({
"invoke": [
[SageMaker_tfaws, ["_invoke"]],
[this.endpointName, []],
[this.inferenceComponentName, []],
],
"$inflight_init": [
[SageMaker_tfaws, []],
[this.endpointName, []],
[this.inferenceComponentName, []],
],
});
}
static get _liftTypeMap() {
return ({
"_invoke": [
],
});
}
}
module.exports = { $preflightTypesMap, SageMaker_tfaws };
//# sourceMappingURL=preflight.sagemakertfaws-3.cjs.map