[英]Value is not a member of Object when trying to pass dynamic variable
I've got the following code我有以下代码
val region = envArgs("region")
// create a client object of class AWSSimpleSystemsManagementClient
val client: AWSSimpleSystemsManagementClient = new AWSSimpleSystemsManagementClient().withRegion(Regions.region)
Region here is a dynamic variable that's passed in the arguments of the glue job.这里的区域是一个动态变量,它在粘合作业的参数中传递。 However, with this code I get the following error但是,使用此代码,我收到以下错误
value region is not a member of object com.amazonaws.regions.Regions
val client: AWSSimpleSystemsManagementClient = new AWSSimpleSystemsManagementClient().withRegion(Regions.region)
Obviously its just trying to find the string "region" in Regions, how can I force it to instead search for the variable?显然它只是试图在 Regions 中找到字符串“region”,我该如何强制它改为搜索变量?
以前的海报删除了他们的答案,但我能够使用以下方法解决这个问题
val client: AWSSimpleSystemsManagementClient = new AWSSimpleSystemsManagementClient().withRegion(Regions.getCurrentRegion)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.