Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public bind(task: sfn.Task): sfn.StepFunctionsTaskConfig {
// set the sagemaker role or create new one
this._grantPrincipal = this._role = this.props.role || new iam.Role(task, 'SagemakerRole', {
assumedBy: new iam.ServicePrincipal('sagemaker.amazonaws.com'),
inlinePolicies: {
CreateTrainingJob: new iam.PolicyDocument({
statements: [
new iam.PolicyStatement({
actions: [
'cloudwatch:PutMetricData',
'logs:CreateLogStream',
'logs:PutLogEvents',
'logs:CreateLogGroup',
'logs:DescribeLogStreams',
'ecr:GetAuthorizationToken',
...this.props.vpcConfig
? [
'ec2:CreateNetworkInterface',
'ec2:CreateNetworkInterfacePermission',
'ec2:DeleteNetworkInterface',
'ec2:DeleteNetworkInterfacePermission',
'ec2:DescribeNetworkInterfaces',
constructor(scope: Construct, id: string, props: KeyProps = {}) {
super(scope, id);
if (props.policy) {
this.policy = props.policy;
} else {
this.policy = new iam.PolicyDocument();
this.allowAccountToAdmin();
}
const resource = new CfnKey(this, 'Resource', {
description: props.description,
enableKeyRotation: props.enableKeyRotation,
enabled: props.enabled,
keyPolicy: this.policy,
});
this.keyArn = resource.attrArn;
this.keyId = resource.ref;
resource.applyRemovalPolicy(props.removalPolicy);
if (props.alias !== undefined) {
this.addAlias(props.alias);