Allocating EIP using Alibaba python SDK doesn't work - alibaba-cloud

I am using python SDK for using Alibaba ECS . I couldn't create elastic ip (EIP) using it. I've used the following code.
from aliyunsdkcore.client import AcsClient
from aliyunsdkecs.request.v20140526 import AllocateEipAddressRequest
AccessKeyId = '*****************'
AccessKeySecret = '*******************'
DefaultRegion = 'us-east-1'
client = AcsClient(AccessKeyId, AccessKeySecret, DefaultRegion)
request_eip = AllocateEipAddressRequest.AllocateEipAddressRequest()
response = client.do_action_with_exception(request_eip)
It throws the following error.
aliyunsdkcore.acs_exception.exceptions.ServerException: HTTP Status: 500 Error:InternalError The request processing has failed due to some unknown error, exception or failure. RequestID: XXXXXXXXXXXXXXXXXXXXXXXXXXX
What am I missing here?
Please, help!

Here's the response from Alibaba Official support team, which solved my issue.
Dear Customer
We are sorry to inform you that this case is related to a known issue in ECS API. Our backend team will resolve this in the next version of the ECS, VPC API.
Meanwhile please add the optional parameter "InternetChargeType": "PayByBandwidth"in your request as a work around.
#Example Code:
def main():
client = AcsClient(
"LTxxxxxxxxxxxxH",
"RxxxxxxxxxxxxxxT",
"ur region")
request_eip = AllocateEipAddressRequest.AllocateEipAddressRequest()
request_eip.set_InternetChargeType('PayByTraffic')
response = client.do_action_with_exception(request_eip)
print(response)
Thank you

Related

MinIO .Net client API failing with bogus General Exception

MinIO is returning a general exception when calling the API from a .net client. In the library parsing the xml fails telling me that "Client calls PutObjectAsync General Exception 'doctype' is an unexpected token. The expected token is 'DOCTYPE'" which is no help at all.
MinIO Version
2021-09-09T21:37:07Z
Uploading objects using the webconsole works as expected.
Can you share an example of the code you are using? Please make sure you are using the S3 endpoint (running on port 9000 by default) and not the console-ui endpoint (9090 by default).
Here is a simple example of how to use the .net library to connect to the MinIO running on https://play.min.io:9000.
using Minio;
// Initialize the client with access credentials.
private static MinioClient minio = new MinioClient("play.min.io",
"Q3AM3UQ867SPQQA43P2F",
"zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
).WithSSL();
// Create an async task for listing buckets.
var getListBucketsTask = minio.ListBucketsAsync();
// Iterate over the list of buckets.
foreach (Bucket bucket in getListBucketsTask.Result.Buckets)
{
Console.WriteLine(bucket.Name + " " + bucket.CreationDateDateTime);
}
Please read more at https://docs.min.io/docs/dotnet-client-quickstart-guide.html

Does Google Cloud Workflows work in europe-west2?

I'm trying to deploy a Google Cloud Workflow using terraform resource google_workflows_workflow.
Here is my code:
resource "google_workflows_workflow" "example" {
project = var.project_id
name = "workflow-example"
region = "europe-west2"
description = "My first workflow"
service_account = var.service_account_email
source_contents = <<-EOF
# etc...
EOF
It fails with:
Error creating Workflow: googleapi: Error 403: Location europe-west2 is not found or access is unauthorized
Why is this? Is workflows not available in europe-west2?
The closest Workflows region as of April 2021 is europe-west4.
Depending on your use case, region may not be as important for Workflows as it might be for other services. A workflow can call endpoints in any region, and in most cases latency is less important.

Failed to use the AWS greengrasssdk to get thing shadow with error code 404

I want to collect some information with my sensor and analyze them on greengrass core to decide whether send an e-mail by SES to me or not. Everything is ready except my connection between shadow and lambda, which is deployed on my greengrass core. When I try to get information from shadow, I can only get error code like this:
{
"code": 404,
"message": "Shadow Not Found",
"timestamp": 1529392914
}
But actually, the shadow is updated continuously every second. Is there anything that I missed? Or can somebody give me some suggestion? Thanks all!
import greengrasssdk
def lambda_handler(event, context):
seeeduino_client = greengrasssdk.client('iot-data')
client = greengrasssdk.client('iot-data') # it's used for send data to "Iot Cloud"
response = seeeduino_client.get_thing_shadow(thingName='Seeeduino_Cloud')
client.publish(
topic='load/successed',
payload=response["payload"]
)
return
Tim
How are you updating the shadow? Is it updated to IoT Core in the cloud, or it is updated to Greengrass Local shadow? These two are independent in GG.

Gmail Gadget Error 406 being thrown on osapi.http.post

We have multiple marketplace Apps that use Gmail Contextual Gadgets. These have been running for years successfully.
We are now noticing the following intermittent error being thrown when calling out to an external web server using open social osapi.http.post
"{"id":"http.post","error":{"message":"Response not valid JSON","code":406}}"
We have checked and there is nothing wrong with our server. We can make the call directly to our server successfully without fail.
We can replicate the issue calling to multiple servers running different apps/gadgets. The only commonality appears to be the use of osapi.http.post.
Here is the post
osapi.http.post({
'body': postdata,
'href': serverUrl + 'iLinkStreamer.ashx?data=' + "" + setTimeStamp() + debugString,
'format': 'json',
'authz': 'signed',
'noCache': true
}).execute(displayStreamList);
which raises the 406 error as above
Has anybody else noticed this issue?? Not sure how we can address it?
I had the same issue for a while and finally found the problem. I was also invoking external resources using osapi.http.post. I read the new documentation and found that there is a new way to do the same.
Check this url for more details, but the idea is that now you'll need to use makeRequest API, it will look something like this:
var params = {};
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
gadgets.io.makeRequest("https://your.backend.com", on_response_function, params);
...
def on_response_function(response){ ... }
I hope this helps someone.
I'm not sure if I'm the only one, but I never received a notification message that the previous API will be deprecated. :(

Get youtube video's comments - dart

I'am trying to get youtube video's comments from my dart console application. I create application in google console.
Then I try to get video list:
import "package:googleapis/youtube/v3.dart" as youtube;
import "package:http/http.dart" as http;
void main() {
http.Client client = new http.Client();
youtube.YoutubeApi api = new youtube.YoutubeApi(client);
api.videos.list("title", id: "ZkGSR0Q492g").then((youtube.VideoListResponse list) {
// print("List length: " + list.items.length);
});
}
When I run this file in console - I get error:
Uncaught Error: DetailedApiRequestError(status: 403, message: Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.)
I understand that I never indicated API-key applications. I think that the error due to this.
But I can not figure out where I need to specify it?
I guess you need to create an authenticated client using https://pub.dartlang.org/packages/google_oauth2_client (detailed instructions in the README.md)
Now I use package "googleapis_oauth". And in this package we have method clientViaApiKey in auth_io.dart. This is solve my problem.

Resources