How to set endpoint in apigatewaymanager
#185
-
I am trying to post to a connection on let client = Client::from_env();
client
.post_to_connection()
.set_connection_id(Some(connection_id))
.set_data(Some(gwm::Blob::new(to_string(&e["body"])?)))
.send()
.await
.expect("Failed to post to connection"); This one I never expected to work since it wouldn't be able to guess the endpoint's The next thing I tried was the following: let client = Client::from_conf(
Config::builder()
.endpoint_resolver(Endpoint::immutable(http::Uri::from_str(
std::env::var("API_GW_ENDPOINT")
.expect("API_GW_ENDPOINT not found")
.as_str(),
)?))
.build(),
);
client
.post_to_connection()
.set_connection_id(Some(connection_id))
.set_data(Some(gwm::Blob::new(to_string(&e["body"])?)))
.send()
.await
.expect("Failed to post to connection"); Note, in the above code, the Any help at all would be much appreciated! EditI did not provide the error output because it was just showing some opaque |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Have you taken a look at the AWS docs here? |
Beta Was this translation helpful? Give feedback.
-
Sorry for the delay, we have an example here: https://github.com/awslabs/aws-sdk-rust/blob/main/examples/apigatewaymanagement/src/bin/post_to_connection.rs |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Sorry for the delay, we have an example here: https://github.com/awslabs/aws-sdk-rust/blob/main/examples/apigatewaymanagement/src/bin/post_to_connection.rs