Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@collaborne/custom-cloudformation-resources

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@collaborne/custom-cloudformation-resources - npm Package Compare versions

Comparing version 0.5.13 to 0.5.15

4

dist/cloudfront-waf-v2-rule-group/index.d.ts

@@ -0,1 +1,2 @@

import { WAFV2 } from 'aws-sdk';
import { SchemaType } from '@collaborne/json-schema-to-type';

@@ -32,5 +33,6 @@ import { CustomResource, Response } from '../custom-resource';

deleteResource(physicalResourceId: string, { Name: name }: SchemaType<typeof SCHEMA>): Promise<Response<ResourceAttributes>>;
updateResource(physicalResourceId: string, { Name: name }: SchemaType<typeof SCHEMA>): Promise<Response<ResourceAttributes>>;
updateResource(physicalResourceId: string, { Name, Description, Rules }: SchemaType<typeof SCHEMA>): Promise<Response<ResourceAttributes>>;
protected getRuleGroup(name: string): Promise<WAFV2.GetRuleGroupResponse>;
protected getRuleGroupAttributes(name: string): Promise<ResourceAttributes>;
}
export {};

@@ -77,3 +77,3 @@ "use strict";

Id: attributes.Id,
LockToken: `${name}-delete-token`,
LockToken: 'delete',
})

@@ -85,11 +85,29 @@ .promise();

}
async updateResource(physicalResourceId, { Name: name }) {
const attributes = await this.getRuleGroupAttributes(name);
async updateResource(physicalResourceId, { Name, Description, Rules }) {
var _a, _b, _c;
const ruleGroup = await this.getRuleGroup(Name);
if (!ruleGroup.RuleGroup) {
throw new Error(`Rule group cannot find ${Name}`);
}
const rules = JSON.parse(Rules);
await this.wafV2
.updateRuleGroup({
Id: (_a = ruleGroup.RuleGroup) === null || _a === void 0 ? void 0 : _a.Id,
Name,
Description,
Scope: SCOPE,
Rules: rules,
VisibilityConfig: ruleGroup.RuleGroup.VisibilityConfig,
LockToken: 'update',
})
.promise();
return {
physicalResourceId,
attributes,
attributes: {
Arn: (_b = ruleGroup.RuleGroup) === null || _b === void 0 ? void 0 : _b.ARN,
Id: (_c = ruleGroup.RuleGroup) === null || _c === void 0 ? void 0 : _c.Id,
},
};
}
async getRuleGroupAttributes(name) {
var _a, _b, _c;
async getRuleGroup(name) {
const ruleGroup = await this.wafV2.getRuleGroup({ Name: name }).promise();

@@ -99,2 +117,7 @@ if (!ruleGroup) {

}
return ruleGroup;
}
async getRuleGroupAttributes(name) {
var _a, _b, _c;
const ruleGroup = await this.getRuleGroup(name);
if (!((_a = ruleGroup.RuleGroup) === null || _a === void 0 ? void 0 : _a.ARN) || !ruleGroup.RuleGroup.Id) {

@@ -101,0 +124,0 @@ throw new Error(`Missing properties for rule group ${name}`);

{
"name": "@collaborne/custom-cloudformation-resources",
"version": "0.5.13",
"version": "0.5.15",
"description": "Custom CloudFormation resources",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -102,3 +102,3 @@ import { WAFV2 } from 'aws-sdk';

Id: attributes.Id,
LockToken: `${name}-delete-token`,
LockToken: 'delete',
})

@@ -114,15 +114,36 @@ .promise();

physicalResourceId: string,
{ Name: name }: SchemaType<typeof SCHEMA>,
{ Name, Description, Rules }: SchemaType<typeof SCHEMA>,
): Promise<Response<ResourceAttributes>> {
const attributes = await this.getRuleGroupAttributes(name);
const ruleGroup = await this.getRuleGroup(Name);
if (!ruleGroup.RuleGroup) {
throw new Error(`Rule group cannot find ${Name}`);
}
const rules: Rules = JSON.parse(Rules);
await this.wafV2
.updateRuleGroup({
Id: ruleGroup.RuleGroup?.Id,
Name,
Description,
Scope: SCOPE,
Rules: rules,
VisibilityConfig: ruleGroup.RuleGroup.VisibilityConfig,
LockToken: 'update',
})
.promise();
return {
physicalResourceId,
attributes,
attributes: {
Arn: ruleGroup.RuleGroup?.ARN,
Id: ruleGroup.RuleGroup?.Id,
},
};
}
protected async getRuleGroupAttributes(
protected async getRuleGroup(
name: string,
): Promise<ResourceAttributes> {
): Promise<WAFV2.GetRuleGroupResponse> {
const ruleGroup = await this.wafV2.getRuleGroup({ Name: name }).promise();

@@ -133,2 +154,10 @@ if (!ruleGroup) {

return ruleGroup;
}
protected async getRuleGroupAttributes(
name: string,
): Promise<ResourceAttributes> {
const ruleGroup = await this.getRuleGroup(name);
if (!ruleGroup.RuleGroup?.ARN || !ruleGroup.RuleGroup.Id) {

@@ -135,0 +164,0 @@ throw new Error(`Missing properties for rule group ${name}`);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc