AWS Simple Workflow - respondDecisionTaskCompleted Not Working? - amazon-web-services

I am currently using the PHP SDK for SWF. I successfully pull decision tasks using:
$result = $client->pollForDecisionTask(array(
"domain" => "test",
"taskList" => array(
"name" => "mainTaskList"
),
"identify" => "default",
"maximumPageSize" => 50,
"reverseOrder" => true
));
$activity_type_version = "1.0";
$task_token = $result["taskToken"];
$run_id = $result["workflowExecution"]["runId"];
$last_event = $result["events"][0]["eventId"];
if($last_event == "3"){
$activity_type_name = "SlamStart";
}
I then try to register my completed decision task with the following:
$result = $client->respondDecisionTaskCompleted(array(
"taskToken" => $task_token,
"decisions" => array(
"decisionType" => "ScheduleActivityTask",
"scheduleActivityTaskDecisionAttributes" => array(
"activityType" => array(
"name" => $activity_type_name,
"version" => $activity_type_version
),
"activityId" => "1",
"control" => "something",
"scheduleToCloseTimeout" => "300",
"scheduleToStartTimeout" => "300",
"startToCloseTimeout" => "300",
"heartbeatTimeout" => "300",
"taskList" => array(
"name" => "mainTaskList"
),
"input" => "test input"
)
)
));
echo "respondDecisionTaskCompleted call went through";
The above never goes through and the last line with echo is never reached.
Why is this happening?

The decisions property has one array wrapped inside of a second array. Instead of
"decisions" => array(
"decisionType" => "ScheduleActivityTask",
"scheduleActivityTaskDecisionAttributes" => array(
"activityType" => array(
"name" => $activity_type_name,
"version" => $activity_type_version
),
"activityId" => "1",
"control" => "something",
"scheduleToCloseTimeout" => "300",
"scheduleToStartTimeout" => "300",
"startToCloseTimeout" => "300",
"heartbeatTimeout" => "300",
"taskList" => array(
"name" => "mainTaskList"
),
"input" => "test input"
)
)
Had to change it to:
"decisions" => array(
array(
"decisionType" => "ScheduleActivityTask",
"scheduleActivityTaskDecisionAttributes" => array(
"activityType" => array(
"name" => $activity_type_name,
"version" => $activity_type_version
),
"activityId" => "1",
"control" => "something",
"scheduleToCloseTimeout" => "300",
"scheduleToStartTimeout" => "300",
"startToCloseTimeout" => "300",
"heartbeatTimeout" => "300",
"taskList" => array(
"name" => "mainTaskList"
),
"input" => "test input"
)
)
)

Related

How to pay a specific invoice in netsuite? using customerPayment

I am trying to pay a specific invoice using the customerpaymet endpoint, I made the JSON structure using the documentation from https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2021.1/index.html#/definitions/customerPayment-applyCollection
This is my JSON:
{
"aracct": {
"id": "259"
},
"autoApply": false,
"apply": {
"items": [
{
"amount": 12.06,
"apply": true,
"doc": {
"id": 5517
}
}
]
},
"tranDate": "2021-10-13 3:34:01 PM",
"customForm": {
"id": "70"
},
"customer": {
"id": "3645"
},
"payment": 12.06,
"subsidiary": {
"id": "3"
}
}
This is the error:
{
"detail": "Error while accessing a resource. You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.",
"o:errorPath": "apply",
"o:errorCode": "USER_ERROR"
}
I would appreciate any help!
This is how i do it in PHP, you can look at it for ideas on what you can try changing.
$request = [
'record_data' => [
[
'internalid' => $nsOrder['internalId'],
'source_type' => 'invoice',
'result_type' => 'customerpayment',
'transform_values' => '',
'literal_fields'=> [
'undepfunds' => 'F',
'account' => '123',
'customer' => $nsOrder['entity']['internalId'],
'paymentmethod' => '8',//cc
'memo' => $message,
],
'sublists'=> [
['name'=>'apply',
'update' => [
[
'match'=> 'internalid',
'data'=>[
'internalid'=>$nsOrder['internalId'],
'apply'=>'T',
'amount' => $nsOrder['amountRemaining']
]
]
]
]
]
]
]
];
$result = $this->curl->transform($request);
The answer is that you need to select a combination of Undep Funds | PaymentMethod and Account in order for this to succeed. The documentation for this exists here

Facebook Marketing API Placement asset customization asset_feed_spec error

I'v been trying to automatically generate ads with different content based on the placements (facebook-feed, messenger-story). I'v been trying to follow the documentation.
https://developers.facebook.com/docs/marketing-api/dynamic-creative/placement-asset-customization#asset-feed
But for some reason, it returns an error saying that the entire object_story_spec is wrong. But this probably has to do something with my asset_feed_spec, because it's the only thing I have been changing.
object_story_spec param is invalid
Object story spec is ill formed. Maybe missing Page ID or creative details, or invalid fields exist
Have anyone tried to do this before? Or is there any way for me to get a clearer error message?
Here is the code I'm using when trying to create the creative.
$creative->setData([
AdCreativeFields::CALL_TO_ACTION_TYPE => $callToAction,
AdCreativeFields::IMAGE_HASH => $image_hash,
AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
AdCreativeFields::ASSET_FEED_SPEC => $this->getAssetFeedSpec($post_message, $link_url, $headline, $image_hash, $description)
]);
To make it a bit more readable, I created a function that creates the different Asset feed specifications. To understand it a bit better, see the example in the documentation.
https://developers.facebook.com/docs/marketing-api/dynamic-creative/placement-asset-customization#supported-fields
public function getAssetFeedSpec($post_message, $link_url, $headline, $image_hash, $description) {
return [
'images' => [
[
'hash' => $image_hash
]
],
'bodies' => [
[
'adlabels' => [
[
'name' => 'labelfirst',
]
],
'text' => $post_message
],
[
'adlabels' => [
[
'name' => 'labelsecond',
]
],
'text' => $headline
]
],
'titles' => [
[
'text' => $headline
]
],
'descriptions' => [
[
'text' => $description
]
],
'ad_formats' => [
'SINGLE_IMAGE'
],
'call_to_action_types' => [
'LEARN_MORE'
],
'link_urls' => [
[
'website_url' => $link_url
]
],
'videos' => [],
'asset_customization_rules' => $this->getAssetCustomizationRules()
];
}
I also separated the asset_customization_rules to make that a bit more understandable.
public function getAssetCustomizationRules() {
return [
[
'customization_spec' => [
'publisher_platforms' => [
'facebook',
'instagram',
'audience_network',
'messenger'
],
'facebook_positions' => [
'feed',
],
'instagram_positions' => [
'stream'
],
'audience_network_positions' => [
'classic'
]
],
'body_label' => [
'name' => 'labelfirst'
]
],
[
'customization_spec' => [
'publisher_platforms' => [
'messenger'
],
'messenger_positions' => [
'stream'
]
],
'body_label' => [
'name' => 'labelsecond'
]
]
];
}
To generate creative, you need to pass object_story_spec with valid page_id just like below,
{
"object_story_spec": {
"page_id": "10506210208xxx"
},
"asset_feed_spec": {
"videos": [
{
"adlabels": [
{
"name": "placement_asset_3667064314xxx"
}
],
"video_id": "3667064314xxx"
},
..
It should work after providing a valid page_id, It's working for me.

Terraform deletes route tables then adds them on second run (no changes). Bug or am I missing something?

As you can see bellow I apply the same code (with no changes whatsoever) twice. The first time it deletes table routes.
The second time it re-creates them.
This behaviour is driving me mad. Every time I have changes to my networking, I need to run terraform twice in order to have my route tables present.
Any light in this issue is very welcome.
$ terraform apply
aws_vpc.vpc: Refreshing state... (ID: [REDACTED])
aws_route_table.public_route: Refreshing state... (ID: [REDACTED])
aws_route.peer_private_1: Refreshing state... (ID: [REDACTED])
aws_route.billing_private_1: Refreshing state... (ID: [REDACTED])
aws_route.billing_public_1: Refreshing state... (ID: [REDACTED])
aws_route_table_association.route_table_pub_1: Refreshing state... (ID: [REDACTED])
aws_route.rt_public_1b: Refreshing state... (ID: [REDACTED])
aws_route.local_public_1: Refreshing state... (ID: [REDACTED])
aws_route.rt_public_1a: Refreshing state... (ID: [REDACTED])
aws_route_table.private_route_1: Refreshing state... (ID: [REDACTED])
aws_route_table_association.route_table_priv_1: Refreshing state... (ID: [REDACTED])
aws_route.rt_private_1a: Refreshing state... (ID: [REDACTED])
aws_route.local_private_1: Refreshing state... (ID: [REDACTED])
aws_route.rt_private_1b: Refreshing state... (ID: [REDACTED])
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
~ module.vpc_network.aws_route_table.private_route_1
route.#: "4" => "1"
route.1.cidr_block: "" => "[REDACTED]"
route.1.egress_only_gateway_id: "" => ""
route.1.gateway_id: "" => "[REDACTED]"
route.1.instance_id: "" => ""
route.1.ipv6_cidr_block: "" => ""
route.1.nat_gateway_id: "" => ""
route.1.network_interface_id: "" => ""
route.1.vpc_peering_connection_id: "" => ""
route.2.cidr_block: "[REDACTED]" => ""
route.2.egress_only_gateway_id: "" => ""
route.2.gateway_id: "" => ""
route.2.instance_id: "" => ""
route.2.ipv6_cidr_block: "" => ""
route.2.nat_gateway_id: "[REDACTED]" => ""
route.2.network_interface_id: "" => ""
route.2.vpc_peering_connection_id: "" => ""
route.3.cidr_block: "[REDACTED]" => ""
route.3.egress_only_gateway_id: "" => ""
route.3.gateway_id: "" => ""
route.3.instance_id: "" => ""
route.3.ipv6_cidr_block: "" => ""
route.3.nat_gateway_id: "" => ""
route.3.network_interface_id: "" => ""
route.3.vpc_peering_connection_id: "[REDACTED]" => ""
route.4.cidr_block: "[REDACTED]" => ""
route.4.egress_only_gateway_id: "" => ""
route.4.gateway_id: "" => ""
route.4.instance_id: "" => ""
route.4.ipv6_cidr_block: "" => ""
route.4.nat_gateway_id: "" => ""
route.4.network_interface_id: "" => ""
route.4.vpc_peering_connection_id: "[REDACTED]" => ""
route.5.cidr_block: "[REDACTED]" => ""
route.5.egress_only_gateway_id: "" => ""
route.5.gateway_id: "" => ""
route.5.instance_id: "" => ""
route.5.ipv6_cidr_block: "" => ""
route.5.nat_gateway_id: "" => ""
route.5.network_interface_id: "" => ""
route.5.vpc_peering_connection_id: "[REDACTED]" => ""
~ module.vpc_network.aws_route_table.public_route
route.#: "4" => "1"
route.3.cidr_block: "[REDACTED]" => ""
route.3.egress_only_gateway_id: "" => ""
route.3.gateway_id: "" => ""
route.3.instance_id: "" => ""
route.3.ipv6_cidr_block: "" => ""
route.3.nat_gateway_id: "" => ""
route.3.network_interface_id: "" => ""
route.3.vpc_peering_connection_id: "[REDACTED]" => ""
route.6.cidr_block: "[REDACTED]" => "[REDACTED]"
route.6.egress_only_gateway_id: "" => ""
route.6.gateway_id: "[REDACTED]" => "[REDACTED]"
route.6.instance_id: "" => ""
route.6.ipv6_cidr_block: "" => ""
route.6.nat_gateway_id: "" => ""
route.6.network_interface_id: "" => ""
route.6.vpc_peering_connection_id: "" => ""
route.4.cidr_block: "[REDACTED]" => ""
route.4.egress_only_gateway_id: "" => ""
route.4.gateway_id: "" => ""
route.4.instance_id: "" => ""
route.4.ipv6_cidr_block: "" => ""
route.4.nat_gateway_id: "" => ""
route.4.network_interface_id: "" => ""
route.4.vpc_peering_connection_id: "[REDACTED]" => ""
route.5.cidr_block: "[REDACTED]" => ""
route.5.egress_only_gateway_id: "" => ""
route.5.gateway_id: "" => ""
route.5.instance_id: "" => ""
route.5.ipv6_cidr_block: "" => ""
route.5.nat_gateway_id: "" => ""
route.5.network_interface_id: "" => ""
route.5.vpc_peering_connection_id: "[REDACTED]" => ""
Plan: 0 to add, 2 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.vpc_network.aws_route_table.private_route_1: Modifying... (ID: [REDACTED])
route.#: "4" => "1"
route.1.cidr_block: "" => "[REDACTED]"
route.1.egress_only_gateway_id: "" => ""
route.1.gateway_id: "" => "[REDACTED]"
route.1.instance_id: "" => ""
route.1.ipv6_cidr_block: "" => ""
route.1.nat_gateway_id: "" => ""
route.1.network_interface_id: "" => ""
route.1.vpc_peering_connection_id: "" => ""
route.2.cidr_block: "[REDACTED]" => ""
route.2.egress_only_gateway_id: "" => ""
route.2.gateway_id: "" => ""
route.2.instance_id: "" => ""
route.2.ipv6_cidr_block: "" => ""
route.2.nat_gateway_id: "[REDACTED]" => ""
route.2.network_interface_id: "" => ""
route.2.vpc_peering_connection_id: "" => ""
route.3.cidr_block: "[REDACTED]" => ""
route.3.egress_only_gateway_id: "" => ""
route.3.gateway_id: "" => ""
route.3.instance_id: "" => ""
route.3.ipv6_cidr_block: "" => ""
route.3.nat_gateway_id: "" => ""
route.3.network_interface_id: "" => ""
route.3.vpc_peering_connection_id: "[REDACTED]" => ""
route.4.cidr_block: "[REDACTED]" => ""
route.4.egress_only_gateway_id: "" => ""
route.4.gateway_id: "" => ""
route.4.instance_id: "" => ""
route.4.ipv6_cidr_block: "" => ""
route.4.nat_gateway_id: "" => ""
route.4.network_interface_id: "" => ""
route.4.vpc_peering_connection_id: "[REDACTED]" => ""
route.5.cidr_block: "[REDACTED]" => ""
route.5.egress_only_gateway_id: "" => ""
route.5.gateway_id: "" => ""
route.5.instance_id: "" => ""
route.5.ipv6_cidr_block: "" => ""
route.5.nat_gateway_id: "" => ""
route.5.network_interface_id: "" => ""
route.5.vpc_peering_connection_id: "[REDACTED]" => ""
module.vpc_network.aws_route_table.private_route_2: Modifying... (ID: [REDACTED])
route.#: "4" => "1"
route.1.cidr_block: "" => "[REDACTED]"
route.1.egress_only_gateway_id: "" => ""
route.1.gateway_id: "" => "[REDACTED]"
route.1.instance_id: "" => ""
route.1.ipv6_cidr_block: "" => ""
route.1.nat_gateway_id: "" => ""
route.1.network_interface_id: "" => ""
route.1.vpc_peering_connection_id: "" => ""
route.2.cidr_block: "[REDACTED]" => ""
route.2.egress_only_gateway_id: "" => ""
route.2.gateway_id: "" => ""
route.2.instance_id: "" => ""
route.2.ipv6_cidr_block: "" => ""
route.2.nat_gateway_id: "[REDACTED]" => ""
route.2.network_interface_id: "" => ""
route.2.vpc_peering_connection_id: "" => ""
route.3.cidr_block: "[REDACTED]" => ""
route.3.egress_only_gateway_id: "" => ""
route.3.gateway_id: "" => ""
route.3.instance_id: "" => ""
route.3.ipv6_cidr_block: "" => ""
route.3.nat_gateway_id: "" => ""
route.3.network_interface_id: "" => ""
route.3.vpc_peering_connection_id: "[REDACTED]" => ""
route.4.cidr_block: "[REDACTED]" => ""
route.4.egress_only_gateway_id: "" => ""
route.4.gateway_id: "" => ""
route.4.instance_id: "" => ""
route.4.ipv6_cidr_block: "" => ""
route.4.nat_gateway_id: "" => ""
route.4.network_interface_id: "" => ""
route.4.vpc_peering_connection_id: "[REDACTED]" => ""
route.5.cidr_block: "[REDACTED]" => ""
route.5.egress_only_gateway_id: "" => ""
route.5.gateway_id: "" => ""
route.5.instance_id: "" => ""
route.5.ipv6_cidr_block: "" => ""
route.5.nat_gateway_id: "" => ""
route.5.network_interface_id: "" => ""
route.5.vpc_peering_connection_id: "[REDACTED]" => ""
module.vpc_network.aws_route_table.public_route: Modifying... (ID: [REDACTED])
route.#: "4" => "1"
route.3.cidr_block: "[REDACTED]" => ""
route.3.egress_only_gateway_id: "" => ""
route.3.gateway_id: "" => ""
route.3.instance_id: "" => ""
route.3.ipv6_cidr_block: "" => ""
route.3.nat_gateway_id: "" => ""
route.3.network_interface_id: "" => ""
route.3.vpc_peering_connection_id: "[REDACTED]" => ""
route.6.cidr_block: "[REDACTED]" => "[REDACTED]"
route.6.egress_only_gateway_id: "" => ""
route.6.gateway_id: "[REDACTED]" => "[REDACTED]"
route.6.instance_id: "" => ""
route.6.ipv6_cidr_block: "" => ""
route.6.nat_gateway_id: "" => ""
route.6.network_interface_id: "" => ""
route.6.vpc_peering_connection_id: "" => ""
route.4.cidr_block: "[REDACTED]" => ""
route.4.egress_only_gateway_id: "" => ""
route.4.gateway_id: "" => ""
route.4.instance_id: "" => ""
route.4.ipv6_cidr_block: "" => ""
route.4.nat_gateway_id: "" => ""
route.4.network_interface_id: "" => ""
route.4.vpc_peering_connection_id: "[REDACTED]" => ""
route.5.cidr_block: "[REDACTED]" => ""
route.5.egress_only_gateway_id: "" => ""
route.5.gateway_id: "" => ""
route.5.instance_id: "" => ""
route.5.ipv6_cidr_block: "" => ""
route.5.nat_gateway_id: "" => ""
route.5.network_interface_id: "" => ""
route.5.vpc_peering_connection_id: "[REDACTED]" => ""
module.vpc_network.aws_route_table.public_route: Modifications complete after 1s (ID: [REDACTED])
module.vpc_network.aws_route_table.private_route_1: Modifications complete after 1s (ID: [REDACTED])
module.vpc_network.aws_route_table.private_route_2: Modifications complete after 1s (ID: [REDACTED])
Apply complete! Resources: 0 added, 5 changed, 0 destroyed.
$ terraform apply
aws_route_table.public_route: Refreshing state... (ID: [REDACTED])
aws_route.peer_private_1: Refreshing state... (ID: [REDACTED])
aws_vpc_peering_connection_accepter.peer: Refreshing state... (ID: [REDACTED])
aws_route.peer_public_1: Refreshing state... (ID: [REDACTED])
aws_route.billing_private_1: Refreshing state... (ID: [REDACTED])
aws_route.billing_public_1: Refreshing state... (ID: [REDACTED])
aws_route_table_association.route_table_pub_1: Refreshing state... (ID: [REDACTED])
aws_route.rt_public_1a: Refreshing state... (ID: [REDACTED])
aws_route.rt_public_1b: Refreshing state... (ID: [REDACTED])
aws_route.local_public_1: Refreshing state... (ID: [REDACTED])
aws_route_table.private_route_1: Refreshing state... (ID: [REDACTED])
aws_route_table_association.route_table_priv_1: Refreshing state... (ID: [REDACTED])
aws_route.local_private_1: Refreshing state... (ID: [REDACTED])
aws_route.rt_private_1a: Refreshing state... (ID: [REDACTED])
aws_route.rt_private_1b: Refreshing state... (ID: [REDACTED])
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
~ update in-place
Terraform will perform the following actions:
~ module.vpc_network.aws_route_table.private_route_1
route.1.cidr_block: "" => "[REDACTED]"
route.1.egress_only_gateway_id: "" => ""
route.1.gateway_id: "" => "[REDACTED]"
route.1.instance_id: "" => ""
route.1.ipv6_cidr_block: "" => ""
route.1.nat_gateway_id: "" => ""
route.1.network_interface_id: "" => ""
route.1.vpc_peering_connection_id: "" => ""
route.2.cidr_block: "[REDACTED]" => ""
route.2.egress_only_gateway_id: "" => ""
route.2.gateway_id: "" => ""
route.2.instance_id: "" => ""
route.2.ipv6_cidr_block: "" => ""
route.2.nat_gateway_id: "[REDACTED]" => ""
route.2.network_interface_id: "" => ""
route.2.vpc_peering_connection_id: "" => ""
+ module.vpc_peering.aws_route.local_private_1
id: <computed>
destination_cidr_block: "[REDACTED]"
destination_prefix_list_id: <computed>
egress_only_gateway_id: <computed>
gateway_id: <computed>
instance_id: <computed>
instance_owner_id: <computed>
nat_gateway_id: <computed>
network_interface_id: <computed>
origin: <computed>
route_table_id: "[REDACTED]"
state: <computed>
vpc_peering_connection_id: "[REDACTED]"
+ module.vpc_peering.aws_route.local_public_1
id: <computed>
destination_cidr_block: "[REDACTED]"
destination_prefix_list_id: <computed>
egress_only_gateway_id: <computed>
gateway_id: <computed>
instance_id: <computed>
instance_owner_id: <computed>
nat_gateway_id: <computed>
network_interface_id: <computed>
origin: <computed>
route_table_id: "[REDACTED]"
state: <computed>
vpc_peering_connection_id: "[REDACTED]"
+ module.vpc_peering_billing.aws_route.rt_private_1a
id: <computed>
destination_cidr_block: "[REDACTED]"
destination_prefix_list_id: <computed>
egress_only_gateway_id: <computed>
gateway_id: <computed>
instance_id: <computed>
instance_owner_id: <computed>
nat_gateway_id: <computed>
network_interface_id: <computed>
origin: <computed>
route_table_id: "[REDACTED]"
state: <computed>
vpc_peering_connection_id: "[REDACTED]"
+ module.vpc_peering_billing.aws_route.rt_private_1b
id: <computed>
destination_cidr_block: "[REDACTED]"
destination_prefix_list_id: <computed>
egress_only_gateway_id: <computed>
gateway_id: <computed>
instance_id: <computed>
instance_owner_id: <computed>
nat_gateway_id: <computed>
network_interface_id: <computed>
origin: <computed>
route_table_id: "[REDACTED]"
state: <computed>
vpc_peering_connection_id: "[REDACTED]"
+ module.vpc_peering_billing.aws_route.rt_public_1a
id: <computed>
destination_cidr_block: "[REDACTED]"
destination_prefix_list_id: <computed>
egress_only_gateway_id: <computed>
gateway_id: <computed>
instance_id: <computed>
instance_owner_id: <computed>
nat_gateway_id: <computed>
network_interface_id: <computed>
origin: <computed>
route_table_id: "[REDACTED]"
state: <computed>
vpc_peering_connection_id: "[REDACTED]"
+ module.vpc_peering_billing.aws_route.rt_public_1b
id: <computed>
destination_cidr_block: "[REDACTED]"
destination_prefix_list_id: <computed>
egress_only_gateway_id: <computed>
gateway_id: <computed>
instance_id: <computed>
instance_owner_id: <computed>
nat_gateway_id: <computed>
network_interface_id: <computed>
origin: <computed>
route_table_id: "[REDACTED]"
state: <computed>
vpc_peering_connection_id: "[REDACTED]"
Plan: 4 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value:
module.vpc_peering_billing.aws_route.rt_public_1a: Creating...
destination_cidr_block: "" => "[REDACTED]"
destination_prefix_list_id: "" => "<computed>"
egress_only_gateway_id: "" => "<computed>"
gateway_id: "" => "<computed>"
instance_id: "" => "<computed>"
instance_owner_id: "" => "<computed>"
nat_gateway_id: "" => "<computed>"
network_interface_id: "" => "<computed>"
origin: "" => "<computed>"
route_table_id: "" => "[REDACTED]"
state: "" => "<computed>"
vpc_peering_connection_id: "" => "[REDACTED]"
module.vpc_peering_billing.aws_route.rt_public_1b: Creating...
destination_cidr_block: "" => "[REDACTED]"
destination_prefix_list_id: "" => "<computed>"
egress_only_gateway_id: "" => "<computed>"
gateway_id: "" => "<computed>"
instance_id: "" => "<computed>"
instance_owner_id: "" => "<computed>"
nat_gateway_id: "" => "<computed>"
network_interface_id: "" => "<computed>"
origin: "" => "<computed>"
route_table_id: "" => "[REDACTED]"
state: "" => "<computed>"
vpc_peering_connection_id: "" => "[REDACTED]"
module.vpc_network.aws_route_table.private_route_1: Modifying... (ID: [REDACTED])
route.1.cidr_block: "" => "[REDACTED]"
route.1.egress_only_gateway_id: "" => ""
route.1.gateway_id: "" => "[REDACTED]"
route.1.instance_id: "" => ""
route.1.ipv6_cidr_block: "" => ""
route.1.nat_gateway_id: "" => ""
route.1.network_interface_id: "" => ""
route.1.vpc_peering_connection_id: "" => ""
route.2.cidr_block: "[REDACTED]" => ""
route.2.egress_only_gateway_id: "" => ""
route.2.gateway_id: "" => ""
route.2.instance_id: "" => ""
route.2.ipv6_cidr_block: "" => ""
route.2.nat_gateway_id: "[REDACTED]" => ""
route.2.network_interface_id: "" => ""
route.2.vpc_peering_connection_id: "" => ""
module.vpc_peering.aws_route.local_public_1: Creating...
destination_cidr_block: "" => "[REDACTED]"
destination_prefix_list_id: "" => "<computed>"
egress_only_gateway_id: "" => "<computed>"
gateway_id: "" => "<computed>"
instance_id: "" => "<computed>"
instance_owner_id: "" => "<computed>"
nat_gateway_id: "" => "<computed>"
network_interface_id: "" => "<computed>"
origin: "" => "<computed>"
route_table_id: "" => "[REDACTED]"
state: "" => "<computed>"
vpc_peering_connection_id: "" => "[REDACTED]"
module.vpc_peering_billing.aws_route.rt_public_1b: Creation complete after 0s (ID: [REDACTED])
module.vpc_peering.aws_route.local_public_1: Creation complete after 0s (ID: [REDACTED])
module.vpc_peering_billing.aws_route.rt_public_1a: Creation complete after 0s (ID: [REDACTED])
module.vpc_network.aws_route_table.private_route_1: Modifications complete after 0s (ID: [REDACTED])
module.vpc_peering_billing.aws_route.rt_private_1b: Creating...
destination_cidr_block: "" => "[REDACTED]"
destination_prefix_list_id: "" => "<computed>"
egress_only_gateway_id: "" => "<computed>"
gateway_id: "" => "<computed>"
instance_id: "" => "<computed>"
instance_owner_id: "" => "<computed>"
nat_gateway_id: "" => "<computed>"
network_interface_id: "" => "<computed>"
origin: "" => "<computed>"
route_table_id: "" => "[REDACTED]"
state: "" => "<computed>"
vpc_peering_connection_id: "" => "[REDACTED]"
module.vpc_peering_billing.aws_route.rt_private_1a: Creating...
destination_cidr_block: "" => "[REDACTED]"
destination_prefix_list_id: "" => "<computed>"
egress_only_gateway_id: "" => "<computed>"
gateway_id: "" => "<computed>"
instance_id: "" => "<computed>"
instance_owner_id: "" => "<computed>"
nat_gateway_id: "" => "<computed>"
network_interface_id: "" => "<computed>"
origin: "" => "<computed>"
route_table_id: "" => "[REDACTED]"
state: "" => "<computed>"
vpc_peering_connection_id: "" => "[REDACTED]"
module.vpc_peering.aws_route.local_private_1: Creating...
destination_cidr_block: "" => "[REDACTED]"
destination_prefix_list_id: "" => "<computed>"
egress_only_gateway_id: "" => "<computed>"
gateway_id: "" => "<computed>"
instance_id: "" => "<computed>"
instance_owner_id: "" => "<computed>"
nat_gateway_id: "" => "<computed>"
network_interface_id: "" => "<computed>"
origin: "" => "<computed>"
route_table_id: "" => "[REDACTED]"
state: "" => "<computed>"
vpc_peering_connection_id: "" => "[REDACTED]"
module.vpc_peering.aws_route.local_private_1: Creation complete after 0s (ID: [REDACTED])
module.vpc_peering_billing.aws_route.rt_private_1b: Creation complete after 0s (ID: [REDACTED])
module.vpc_peering_billing.aws_route.rt_private_1a: Creation complete after 0s (ID: [REDACTED])
Apply complete! Resources: 4 added, 1 changed, 0 destroyed.
Met same problem: try to add vpc_peering after the creation of route table with route inside, need to run twice to make it right. Resolved with the hint from #James Woolfenden
Just moved the route part out of the creation of aws_route_table, then all the aws_route creation later(such as vpc_peering) will not conflict with route created outside the aws_route_table
Original Code:
# Create crt with nat
resource "aws_route_table" "tf_portal_private_crt" {
count = length(data.aws_availability_zones.available.names)
vpc_id = aws_vpc.tf_portal_vpc.id
route {
//associated subnet can reach everywhere
cidr_block = "0.0.0.0/0"
//CRT uses this nat to reach internet
nat_gateway_id = aws_nat_gateway.tf_portal_nat.id
}
tags = {
Name = "${var.portal_private_crt_name}_${count.index + 1}"
}
}
New Code:
# Create crt with nat
resource "aws_route_table" "tf_portal_private_crt" {
count = length(data.aws_availability_zones.available.names)
vpc_id = aws_vpc.tf_portal_vpc.id
tags = {
Name = "${var.portal_private_crt_name}_${count.index + 1}"
}
}
resource "aws_route" "tf_portal_private" {
count = length(data.aws_availability_zones.available.names)
route_table_id = element(aws_route_table.tf_portal_private_crt.*.id, count.index)
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.tf_portal_nat.id
}

How to get WebView details information by calabash-android?

I plan to use calabash-android to develop automation test script for android app.
But i don't know how to touch/query the "Register" button in below page:
I tried to 'query "*"' in calabash console but can not get any info about the
button. The query output:
irb(main):002:0> query "*"
[
[0] {
"id" => nil,
"enabled" => true,
"contentDescription" => nil,
"visible" => true,
"tag" => nil,
"description" => "com.android.internal.policy.impl.PhoneWindow$De
corView{b11eeb10 V.E..... R.....I. 0,0-768,1134}",
"class" => "com.android.internal.policy.impl.PhoneWindow$De
corView",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
},
[1] {
"id" => nil,
"enabled" => true,
"contentDescription" => nil,
"visible" => true,
"tag" => nil,
"description" => "android.widget.LinearLayout{b10779d0 V.E..... .
.....I. 0,0-768,1134}",
"class" => "android.widget.LinearLayout",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
},
[2] {
"id" => "content",
"enabled" => true,
"contentDescription" => nil,
"visible" => true,
"tag" => nil,
"description" => "android.widget.FrameLayout{b1234b00 V.E..... ..
....I. 0,0-768,1134 #1020002 android:id/content}",
"class" => "android.widget.FrameLayout",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
},
[3] {
"id" => nil,
"enabled" => true,
"contentDescription" => nil,
"visible" => true,
"tag" => nil,
"description" => "android.widget.LinearLayout{b11ecf40 V.E..... .
.....I. 0,0-768,1134}",
"class" => "android.widget.LinearLayout",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
},
[4] {
"id" => "NoResourceEntry-6",
"enabled" => true,
"contentDescription" => "Web View",
"visible" => true,
"tag" => nil,
"description" => "org.apache.cordova.inappbrowser.InAppBrowser$6$
5{b108af68 VFEDHVC. .F....I. 0,0-768,1134 #6}",
"class" => "org.apache.cordova.inappbrowser.InAppBrowser$6$
5",
"rect" => {
"center_y" => 617,
"center_x" => 384,
"height" => 1134,
"y" => 50,
"width" => 768,
"x" => 0
}
}
]
Would you please give me some suggestions? Thanks a lot!
I'm going to answer this thinking your app is an hybrid app. I'm not sure this works for native apps. I doubt it.
If you want to get some information about all your elements in DOM you should use this instruction:
query("systemWebview css:'*'")
That instruction will return an array with all elements on the web view. You'll get classes, ids, etc. If you want to get only the elements which textContent contains the word Register (which will help you find it easier) you should run this:
query("systemWebview css:'*' {textContent CONTAINS 'Register'}")
Check the results and tell me: Is that what you want?

Ember model not displaying field data in template

app/models/index.js
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
export default Model.extend({
title: attr(),
owner: attr(),
city: attr(),
type: attr(),
image: attr(),
bedrooms: attr()
});
app/template/index.hbs
{{#each model as |rental|}}
<p>Location: {{rental.city}}</p>
<p>Number of bedrooms: {{rental.bedrooms}}</p>
{{/each}}
Am returning this from sinatra for the /rentals data request
{ data: [{
id: 1,
title: 'Grand Old Mansion',
owner: 'Veruca Salt',
city: 'San Francisco',
bedrooms: 15,
type: 'rental',
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg'
}, {
id: 2,
title: 'Urban Living',
owner: 'Mike TV',
city: 'Seattle',
bedrooms: 1,
type: 'rental',
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_T egucigalpa.jpg'
}, {
id: 3,
title: 'Downtown Charm',
owner: 'Violet Beauregarde',
city: 'Portland',
bedrooms: 3,
type: 'rental',
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Bu ilding_-_Portland_Oregon.jpg'
}, {
id: 4,
title: 'xDowntown Charm',
owner: 'Violet Beauregarde',
city: 'Portland',
bedrooms: 3,
type: 'rental',
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg'
}]}.to_json
the each loop knows how many records are there but the field data is missing as the browser shows this
Location:
Number of bedrooms:
Location:
Number of bedrooms:
Location:
Number of bedrooms:
Location:
Number of bedrooms:
Using ember 2.5
Per comment by dynamic_cast I changed the JSON structure to this and got it to work.
{
"data" => [{
"type" => "rentals",
"id" => "1",
"attributes" => {
"title" => 'Grand Old Mansion',
"owner" => 'Veruca Salt',
"city" => 'San Francisco',
"bedrooms" => 15,
"type" => 'rental',
"image" => 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg'
}
},
{
"type" => "rentals",
"id" => "2",
"attributes" => {
"title" => 'Urban Living',
"owner" => 'Mike TV',
"city" => 'Seattle',
"bedrooms" => 1,
"type" => 'rental',
"image" => 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_T egucigalpa.jpg'
}
},
{
"type" => "rentals",
"id" => "3",
"attributes" => {
"title" => 'Downtown Charm',
"owner" => 'Violet Beauregarde',
"city" => 'Portland',
"type" => 'Apartment',
"bedrooms" => 3,
"image" => 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg'
}
}
]
}.to_json