我正在尝试创建一个带有aws-sdk
的课程,我得到:
Service must be constructed with `new` operator
以下是代码:
Class AWS {
// constructor omitted
connect({client='ecs'}={})
{
let config =
{
accessKeyId: this.aws_access_key,
secretAccessKey: this.aws_secret_key,
region: this.region
};
try {
switch (client) {
case 'dynamodb': conn = aws.DYNAMODB(config); break;
case 'ec2': conn = aws.EC2(config); break;
case 'ecs': conn = aws.ECS(config); break;
case 'elb': conn = aws.ELBv2(config); break;
}
return conn;
}
catch(err)
{
console.log(err.message);
}
}
}
以下是我如何称呼它......
var a = new AWS(
{
cluster: 'my-cluster',
environment: 'dev',
project: 'proj1',
region: 'us-east-2',
service: 'api-feed-validation'
});
a.connect({client:'ecs'})
我不知道自己错过了什么......
答案 0 :(得分:1)
这是抱怨,因为您试图在 Q + ans Q + ans broken search Bing total Search mean1 \
count 477.000000 477.000000 4.770000e+02 477.000000
mean 3.972746 30.408805 3.661450e+06 3.972746
std 12.112970 133.128478 1.555090e+07 7.292793
min 0.000000 0.000000 0.000000e+00 0.000000
25% 0.000000 0.000000 8.110000e+04 0.000000
50% 0.000000 0.000000 3.790000e+05 1.333333
75% 2.000000 4.000000 2.000000e+06 5.333333
max 162.000000 1908.000000 2.320000e+08 60.666667
mean2 zeros correct
count 477.000000 477.0 477.000000
mean 30.272537 0.0 0.333333
std 76.365587 0.0 0.471899
min 0.000000 0.0 0.000000
25% 0.000000 0.0 0.000000
50% 1.666667 0.0 0.000000
75% 21.000000 0.0 1.000000
max 636.666667 0.0 1.000000
$category = get_terms([
'taxonomy' => 'category',
'hide_empty' => false,
]);
$category = get_terms([
'taxonomy' => 'category',
'hide_empty' => false,
]);
$property_area = get_terms([
'taxonomy' => 'property_area',
'hide_empty' => false,
]);
$property_type = get_terms([
'taxonomy' => 'property_type',
'hide_empty' => false,
]);
中没有$rent_properties = array(
'post_type' => 'properties',
'posts_per_page' => 20,
'post_status' => 'publish',
'paged' => $paged,
'tax_query' => array(
'relation'=>'AND',
array(
'taxonomy'=>'category',
'field' => 'field_id',
'terms' => $category,
),
array(
'taxonomy'=>'property_area',
'field' => 'fild_id',
'terms' =>$property_area,
),
array(
'taxonomy'=>'property_type',
'field' => 'slug',
'terms' => $property_type
)
)
);
的情况下实例化服务。例如:
new
应该是:
switch
这当然假设你所谓的某个地方:
conn = aws.DYNAMODB(config)