尝试传递动态变量时值不是对象的成员
Value is not a member of Object when trying to pass dynamic variable
我有以下代码
val region = envArgs("region")
// create a client object of class AWSSimpleSystemsManagementClient
val client: AWSSimpleSystemsManagementClient = new AWSSimpleSystemsManagementClient().withRegion(Regions.region)
此处的区域是一个动态变量,它是在粘合作业的参数中传递的。但是,使用此代码我得到以下错误
value region is not a member of object com.amazonaws.regions.Regions
val client: AWSSimpleSystemsManagementClient = new AWSSimpleSystemsManagementClient().withRegion(Regions.region)
显然它只是试图在 Regions 中查找字符串“region”,我如何强制它改为搜索变量?
之前的发帖者删除了他们的答案,但我能够使用以下内容来解决这个问题
val client: AWSSimpleSystemsManagementClient = new AWSSimpleSystemsManagementClient().withRegion(Regions.getCurrentRegion)
我有以下代码
val region = envArgs("region")
// create a client object of class AWSSimpleSystemsManagementClient
val client: AWSSimpleSystemsManagementClient = new AWSSimpleSystemsManagementClient().withRegion(Regions.region)
此处的区域是一个动态变量,它是在粘合作业的参数中传递的。但是,使用此代码我得到以下错误
value region is not a member of object com.amazonaws.regions.Regions
val client: AWSSimpleSystemsManagementClient = new AWSSimpleSystemsManagementClient().withRegion(Regions.region)
显然它只是试图在 Regions 中查找字符串“region”,我如何强制它改为搜索变量?
之前的发帖者删除了他们的答案,但我能够使用以下内容来解决这个问题
val client: AWSSimpleSystemsManagementClient = new AWSSimpleSystemsManagementClient().withRegion(Regions.getCurrentRegion)